Difference between ruby and perl in RegularExpression

Hi every
following ruby snippet

#!/bin/ruby
abc = " Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
"
puts abc
abc.sub!(/le.?$/s, “le Ende” )
puts abc

produces following output:

[git@casablanca ~/work/rad/cgi]$ ruby regex.rbx
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
Erste Zeile Ende
Zweite Zeile
Dritte Zeile
Vierte Zeile
[git@casablanca ~/work/rad/cgi]$

whereas following perl snippet which is functionally equal to the ruby
snippet

#!/bin/perl
$abc = " Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
";
print $abc;
$abc =~ s/le.?$/le Ende\n/s;
print $abc;

produces following output
[git@casablanca ~/work/rad/cgi]$ perl perly.pl
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile
Erste Zeile
Zweite Zeile
Dritte Zeile
Vierte Zeile Ende
[git@casablanca ~/work/rad/cgi]$

Seems that the two disagree in the significance of the s modifier of the
Regular Expression.

Is this a bug on either side?

suomi

I believe that $ in Perl means “end of string” unless you use the
m-modifer. $ is end of line by default in Ruby.