in reply to Deleteing array elements
If you know the index of the element you want to delete you can use a slice
One possibility would be a grep
otherwise I'm not sure if you can avoid an (implicit) loop.@arr = @arr[0,1,3];
One possibility would be a grep
Why do you want to avoid a loop? Are there so many elements in the array? Maybe you could avoid putting the unwanted elements in the array in the first place.@arr = grep { $_ !~ /c/ } @arr;
cheers, si_lence
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Deleting array elements
by davorg (Chancellor) on Jul 23, 2009 at 08:26 UTC | |
by si_lence (Deacon) on Jul 23, 2009 at 08:55 UTC |
In Section
Seekers of Perl Wisdom