in reply to Splicing an array.
you could do this:
Updated to fix silly typo as pointed out by Kozz below
the problem is that you want the "string" to be expanded to a list and that won't happen with your current method. If you really want to use the string, then you have to eval it, as this will cause it be be expanded into a list, thus:my @splice_array = (2, 3..7); print @array[@splice_array];
but that's probably grossly inefficient.my $splice_str = "2,3..7"; print @array[eval $splice_str];
Nuance
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Splicing an array.
by eduardo (Curate) on Aug 13, 2000 at 08:16 UTC | |
|
(Kozz)RE: RE: Splicing an array.
by Kozz (Friar) on Aug 13, 2000 at 08:18 UTC |