in reply to Array Splicing: Need Help!

Or try "array slice"
$ perl -e ' my @colors = qw(red blue orange purple pink white); @colors = @colors[3..$#colors]; print join (" ", @colors),"\n";'
prints:
purple pink white
Update: Check perldata for more detail explanation about slice.

Regards,
Edward

Replies are listed 'Best First'.
Re^2: Array Splicing: Need Help!
by Anonymous Monk on May 26, 2005 at 15:05 UTC
    Cool! Does that mean we can always replace "splice" with "slicing"?
    Is there any case where only "splice" works but not slicing?

      Splicing modifies the array. Slicing returns a list without modifying the original data structure (whether it's a hash, an array, or a list).