in reply to How do you define "elegant"?

my @new_foo; foreach my $a_foo (@foo) { $a_foo = '%'.$a_foo.'%'; push @new_foo, $a_foo; } @foo = @new_foo;
half of those lines are unnecessary!
foreach my $a_foo (@foo) { $a_foo = '%'.$a_foo.'%'; }
modifies each element of @foo in place without the extra @new_foo. i love map, but unless you need both lists when you are done, it's rarely the right tool. benchmark the above foreach against the map, and you should find it to be much faster.

(elegance means ignoring such things when performance is unimportant..)