Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: ARGV issue

by ikegami (Pope)
on Oct 02, 2011 at 21:57 UTC ( #929188=note: print w/ replies, xml ) Need Help??

in reply to ARGV issue

You have a couple mistakes.

  • my($#ARGV) = @_; makes no sense.

  • $arg contains a number, so it'll never be equal to any of the strings to which you compare it. You would need to loop over @ARGV.

I'd use Getopt::Long.

use Getopt::Long qw( GetOptions ); sub usage { print STDERR "...simple usage...\n"; exit(1); } sub help { print "...more extensive help...\n"; exit(0); } GetOptions( 'h|?|help' => \&help, ... ) or usage();

You might also find Pod::Usage of interest.

Comment on Re: ARGV issue
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929188]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2015-12-01 20:14 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (26 votes), past polls