1 2 3 4
my @x = qw(foo bar one two three bar foofoo foobar thisfoowillbebar); map { s/foo/bar/g } @x; # replace any foo with bar # map { s/^foo$/bar/g } @x; # for exact matching print join("\n", @x) . "\n";
1 2 3 4 5 6 7 8 9
bar bar one two three bar barbar barbar thisbarwillbebar