I have a line with possible command line arguments (using the Read-Eval-Print-Loop program), and I want it to be parsed similarly to the command line arguments when passed to Getopt :: Long.
Develop:
I have a line
$str = '--infile /tmp/infile_location --outfile /tmp/outfile'
I want it to be parsed by GetOptions, so it's easier for me to add new parameters.
A workaround I would think is to split the string into spaces and replace @ARGV with a new array, and then call GetOptions. something like...
my @arg_arr = split (/\s/, $input_line);
Is there a good / better way?
perl getopt-long
Jagmal
source share