in reply to Re: Inline substitution regex
in thread Inline substitution regex
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Inline substitution regex
by ikegami (Patriarch) on Sep 29, 2009 at 16:12 UTC |