perlquestion
greatshots
dear monks
<p>
<code>
Prog_name : print.pl
#!/usr/bin/perl
use strict;
use warnings;
my @array = ( 11,12,13,14,15);
#my @new = @array[join(",",@ARGV)];
my @new = @array[1,3];
print "@new\n";
Output :-
12 14
</code>
Changed the code as follows :-
<code>
#!/usr/bin/perl
use strict;
use warnings;
my @array = ( 11,12,13,14,15);
my @new = @array[join(",",@ARGV)];
#my @new = @array[1,3];
print "@new\n";
Output : perl print.pl 1 3
Argument "" isn't numeric in array slice at l.pl line 8.
11
</code>
Is it mandatory that all the arguements which I am passing from command line arguements should need to be converted to numbers ( if it is a number ) to print ? Is there anyother way in which, will I be able to tell my program to treat the command line arguements as integers ?