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";