in reply to Re: Non-destructive string substitution
in thread Non-destructive string substitution
printsmy $foo = "foo"; print map {s/foo/bar/g; $_} do{$foo}; print "\n$foo\n";
This, however, does:bar bar
my $foo = "foo"; print map {s/foo/bar/g; $_} @{[$foo]}; print "\n$foo\n";
-Mark
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Non-destructive string substitution
by japhy (Canon) on Apr 20, 2004 at 18:39 UTC |