use Getopt::Long;
GetOptions(\%gOptions,
"help",
"size=i",
"filename=s{2}",
);
I am passing options like -
--size 200 --filename abc.txt def.txt
I tried accessing filename from the hash specification through
my @array = $gOptions{filename};
print $array[0];
print $array[1];
However, this is not working. How to access multiple option values from a hash specification %gOptions
?
Note :
I can map filename
to separate array like this -
"filename=s{2}" => \@filearray,
print "$filearray[1];"
but I am not preferring this method.