/ Published in: Perl
This is a simplified example for cut and paste use for command line parsing arguments with the use of an options hash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl -w ##Simplified example of using Getopt:Long moudule with an Options hash use Getopt::Long; use strict; my %Opt=(); (GetOptions( \%Opt, "h|help", "s|string=s", "l|list=s@", "i|int=i", "f|float=f", "o|octal=o", ## Or as OO # #my $parser = new Getopt::Long::Parser; #$parser->configure("no_ignore_case"); #if ($parser->getoptions(\%Opt, # "h|help", # "s|string=s", # "l|list=s@", # "i|int=i", # "f|float=f", # "o|octal=o", #)) {}; # ## Just print out the options for each collected to see what there is: }