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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.