in reply to Remove elements from an array
As ikegami says, you should use grep. He gives a good example for excluding elements based on a regular expression, but you might also want to exclude elements based on string equality (which would be far faster, though a different algorithm would probably be even better):
my @new = grep { $_ ne "certain string" } @old;
Or, perhaps you want to search for a substring:
my @new = grep { index($_, "certain string") == -1 } @old;
Just trying to give you some more ideas of how you can use grep... HTH
Update: no fair! ikegami updated his post in the time while I was posting this. Cheater. :-)
|
|---|