in reply to multiple (different) substitutions on same $foo
-Darumause strict; use warnings; my $foo = "The frog kissed the woman and became a man."; print "$foo\n"; my %replace = ( "frog" => "toad", " man" => " boy", "woman" => "girl" ); foreach my $find (keys %replace) { $foo =~ s/$find/$replace{$find}/; } print "$foo\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple (different) substitutions on same $foo (at once)
by tye (Sage) on Aug 22, 2003 at 05:36 UTC | |
by halley (Prior) on Aug 22, 2003 at 12:56 UTC |