in reply to multiple (different) substitutions on same $foo
Yes. Not only that, you can also print the result in one go.
my $foo = "A man and a woman saw a frog by the pond\n"; s/frog/toad/g, s/man/boy/, s/woman/girl/, print for ($foo); __END__ A boy and a girl saw a toad by the pond
update This is beyond the point of the original request, but following halley's lead, a stronger implementation would be
s/\bfrog\b/toad/g, s/\bman\b/boy/, s/\bwoman\b/girl/, print for $foo;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: multiple (different) substitutions on same $foo
by halley (Prior) on Aug 22, 2003 at 13:05 UTC |