in reply to multiple matches in a string

perldoc perlre

To replace All occurrances of a match in a string, instead of just the first, use the /g flag:

$string = "foo, this foo is just a foo"; $string =~ s/foo/bar/g;
Update:"perldoc perlre" was my attempt at a friendly "rtfm" :) Sorry it didn't come across forcefully enough :)

Alan

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.