![]() |
|
Perl: the Markov chain saw | |
PerlMonks |
Re^2: Deleting array elementsby davorg (Chancellor) |
on Jul 23, 2009 at 08:26 UTC ( [id://782590]=note: print w/replies, xml ) | Need Help?? |
@arr = grep { $_ !~ /c/ } @arr; That works, of course, with the sample data that we've been given, but in the general case it will remove any element that contains the letter 'c'. Regular expressions aren't always the answer. Sometimes a simpler approach is right.
In Section
Seekers of Perl Wisdom
|
|