in reply to Assign & substitute in one statement?

If you enclose the assignment in parens, and then do the substitution after the parens, you should get exactly what you want:

perl -le 'use strict; my $str1 = "test"; ( my $str2 = $str1 ) =~ s/t/m/g; print $str2'