Hello I'm quite new to perl, but I have some code already that I need to adapt. The problem is that I don't know how to obtain an array using Getopt::Long
My code is the following:
use Getopt::Long ;
my $input = {output_type => 'default'} ;
my @input_array = {output_type => 'default'} ;
my $p = new Getopt::Long::Parser ;
$p->configure('pass_through') ;
my $getoptret = $p->getoptions(
+ 'files|f:s' =>\@input_array->{files}, #filename(s)
'eventlist|e:s' =>\$input->{eventlist}, #name of the eve
+ntlist
'output_directory|o:s' =>\$input->{output_directory}, # desire
+d output directory
);
die "Error: Give input SEED volume\n" if (! -e @input->{files}) ;
die "Error: Give name of eventlist that should be used\n" if (! $input
+->{eventlist}) ;
die "Error: Give output directory\n" if (! $input->{output_directory})
+ ;
My question:
How can I parse an array by executing the filename with the option "-f test_1 test_2"
The error message I get is:
"No such pseudo-hash field "files" at extract_mini-SEED line 24"
This is the line where my $getoptret gets filled.
I hope someone has an idea.
Thank you in advance.