Hello thanos1983,
I see three problems in your code (there may be others):
You are not saving anything to @xls:
Getopt::Long::GetOptions ( 'f=s{1,}' => sub { print "This is the number of \@ARG arguments inside the proces +s " . @ARGV . "\n"; print "This is the number of \@xls arguments inside the proces +s " . @xls . "\n"; push @xls, pop @_; # <-- Add this }, ...
In this condition: if scalar (@xls == 0); the parentheses apply scalar to the result of the == comparison. You need either if (scalar @xls) == 0; or just if scalar @xls == 0; — or drop the scalar altogether: if @xls == 0.
If you want to print out the contents of @xls, change
print "Input given form \@xls: ".@xls."\n";
to
print "Input given form \@xls: ", join(', ', @xls), "\n";
(because concatenation puts @xls into scalar context).
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Getopt::Long::GetOptions checking input array for file extensions
by Athanasius
in thread Getopt::Long::GetOptions checking input array for file extensions
by thanos1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |