Monday, October 26, 2009

how to remove an element in a Perl array/list

splice does the trick:

@a = qw( A B C D E F G );
splice( @a, 3, 1 );


This will remove 'D' from the @a array. (Remember that indexing starts at 0.

No comments: