I don't understand why, but it's a common misconception that operators return their left-hand argument. Why you expect the following to print 3?
print( 3 + 4 );Then why would expect the following to print $text?
print( $text =~ s/this/that/ );
Well wrong example, IMHO the misconception is motivated by
which prints 7!print( $num = 3 + 4 );
Occasionally it's a trap for me, too! 8)
IIRC the binding operator =~ will be changed in Perl6, which thankfully avoids this misleading association!
Cheers Rolf
In reply to Re^2: Inline substitution regex
by LanX
in thread Inline substitution regex
by bradcan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |