[Perl] 'perl -s' with strict

Yossi.Itzkovich at lightscapenet.com Yossi.Itzkovich at lightscapenet.com
Mon Nov 4 19:20:09 PST 2002


                                                                                                                                 
                      "Reuven M.                                                                                                 
                      Lerner"                  To:      perl at perl.org.il                                                         
                      <reuven at lerner.c         cc:      Uri Itscowits <iuri at sela.co.il>                                          
                      o.il>                    Subject: [Perl] 'perl -s' with strict                                             
                      Sent by:                                                                                                   
                      perl-admin at perl.                                                                                           
                      org.il                                                                                                     
                                                                                                                                 
                                                                                                                                 
                      11/04/2002 17:12                                                                                           
                      Please respond                                                                                             
                      to perl                                                                                                    
                                                                                                                                 
                                                                                                                                 






 ...

(4) Use Getopt::Long, which is my vote for a winning solution.

    -s is obviously weird and somewhat broken, and I'm not sure how
    good of a method it is for receiving values.  I think that you
    would be wise to switch to Getopt::Long, a standard module that
    handles input options with a huge amount of flexibility, and
    without this sort of breakage.

Reuven


Using Getopt::Long, you still have to declare the variable you send, like :

GetOptions("q" => \$q);

So, with  "use strict"  you still have to do something like :
my $q;

beforehand.

BTW: I still like and use this solution the most.

Yossi






More information about the Perl mailing list