in reply to print the array using command line arguements
The problem in your code is the line my @new = @array[join(",",@ARGV)]; because the first element of @ARGV is the program name Fengor writes a 100 times ksh is not perl
try
#!/usr/bin/perl use strict; use warnings; my @array = ( 11,12,13,14,15); #my @new = @array[join(",",@ARGV)]; #my @new = @array[1,3]; my @new = @array[$ARGV[0],$ARGV[1]]; print "@new\n";
--
"WHAT CAN THE HARVEST HOPE FOR IF NOT THE CARE OF THE REAPER MAN"
-- Terry Pratchett, "Reaper Man"
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: print the array using command line arguements
by lidden (Curate) on Nov 30, 2006 at 07:57 UTC | |
by Fengor (Pilgrim) on Nov 30, 2006 at 08:03 UTC | |
Re^2: print the array using command line arguements
by reneeb (Chaplain) on Nov 30, 2006 at 08:00 UTC |
In Section
Seekers of Perl Wisdom