in reply to Applying regex to array
With all the talk of map and side effects, I thought it might be nice to show you a version using map with no side effects. I actually kind of prefer this:
my @fields = qw/this that the_other/; @fields = map { qq("$_") } @fields;
Sure, it copies @fields instead of modifying it in place, but I doubt that makes a significant different in performance (most of the time). I think this is much clearer in expressing your intentions than using s/// with the for loop.
|
|---|