use strict; my @array = qw(foo bar bazzle baz); @array = map { s/^baz$/qux/;$_ } @array;