Oct
11
Quick Command Line Arg parsing
ByTo parse command line arguments passed to a script without using a module, parse @ARGV with the following:
foreach my $arg (@ARGV) { $a = 1, next if $arg eq '-a'; $b = 1, next if $arg eq '-b'; $c = 1, next if $arg eq '-c'; }
Note: This is good only for boolean (on/off) command line switches.
Leave a Comment
You must be logged in to post a comment.