($foo = $bar) =~ s/$pat/$subst/; # operates on $foo