multiline mode in Perl and Ruby different: Ruby is wrong?

前端 未结 0 619
予麋鹿
予麋鹿 2021-01-31 12:53

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         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题