J
Justin
Is there an easy way to use a string as a range of array idices, ie
my @list = (0..9);
my $hi = "0..5,7,9";
print "@list[$hi]\n";
where I want the output to be:
0 1 2 3 4 5 7 9
I can think of really annoying ways to do this, but I was hoping there
would be a nice, easy way. BTW, the end use of this is so that someone
can type in a range of indices as an input (from STDIN), so if there
is an alternative way, that would be great, too.
Thanks,
Justin
my @list = (0..9);
my $hi = "0..5,7,9";
print "@list[$hi]\n";
where I want the output to be:
0 1 2 3 4 5 7 9
I can think of really annoying ways to do this, but I was hoping there
would be a nice, easy way. BTW, the end use of this is so that someone
can type in a range of indices as an input (from STDIN), so if there
is an alternative way, that would be great, too.
Thanks,
Justin