Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a Perl script to get some "named" command line arguments?

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.

like image 721
André Diniz Avatar asked Feb 09 '10 16:02

André Diniz


1 Answers

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.

like image 66
Robert Mah Avatar answered Oct 21 '22 11:10

Robert Mah