Perl, Getopts::Long, and code hacking.

19 May 2007

When working with the Perl, you can use the module Getopt::Long to implement your command line argument parser. However, if your script can take a string of words after the arguments, like this

./my_script.pl --arg1 --arg2 --arg3 foo bar baz quux

the -- options will be removed from @ARGV, leaving only the other words (foo, bar, baz, et al). This means that you don't have to write any routines to dig them out of @ARGV.