Seanie wrote:
yitzle wrote:
What's the best way to apply a RegEx to an array? For loop?
@arr = qw/dc2ds reew12dsfa df2fdw/;
s/$find/$replace/ for(@arr);

Yep, you can do that. Or use map()

map(s/$find/$replace/, @arr);

Haha yes you can, but if you want to write nasty code go for

 grep s/$find/$replace/, @arr;

which also works.

Rob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to