my @output = map { (my $i = $_) =~ s/foo/bar/; $i } @input; #### my @output = map { $_ \~ s/foo/bar/ } @input;