How can I create a Perl script to get some "named" command line arguments?
For example:
perl my_perl.pl -ARG_1 1234 -ARG_2 "Testing"
Where ARG_1 and ARG_2 are the arguments names and 1234 and "Testing" their values.
How can I create a Perl script to get some "named" command line arguments?
For example:
perl my_perl.pl -ARG_1 1234 -ARG_2 "Testing"
Where ARG_1 and ARG_2 are the arguments names and 1234 and "Testing" their values.
You can get a similar effect by using Getopt::Long. The main difference is that it uses gnu-style --arguments by default. It's very flexible and powerful.
See Getopt::Long. If you do not like that, there are many others.
In the simplest case, you could do:
my %args = @ARGV;
print $args{-ARG_1}, "\n";