Let us look at Perl code and result:
$s = "a\\nb\\nc\\n"; $s =~ s/^b/X/; print $s; a b c $s = "a\\nb\\nc\\n"; $s =~ s/^b/X/m; print $s; a X