in reply to Non-destructive string substitution

This code seems to do what you want
my $foo = 'foofoofoo'; print map {s/foo/bar/g; $_} ($foo);
Update: No it doesn't, as $foo is still modified. I don't see a way.

-Mark