my @new = map { s/foo/bar/; $_ } @old; # @old is modified along with @new! # should be my @new = map { s/foo/bar/; $_ } map {$_} @old;