in reply to (tye)Re: fixing Perl's inconsistencies
in thread fixing Perl's inconsistencies

Hmm? $x =~ 0 would be like $x = $x ~ 0, and ~ is unary. No go. ;).

I ran a funny problem, though, with that operator. I was neatening somebody's code:
$this=someFunc(); $that=result($this); $that=~s/(\d+)/data($1)/eg;
And I just padded the = with whitespace:
$this = someFunc(); $that = result($this); $that = ~s/(\d+)/data($1)/eg;
And was baffled momentarily when $that started holding a large number. Then I noticed that number seemed a lot like bitwise negation of 0. D'oh.

japhy -- Perl and Regex Hacker

Replies are listed 'Best First'.
(tye)Re2: fixing Perl's inconsistencies
by tye (Sage) on Feb 20, 2001 at 22:33 UTC

    japhy, just in case you didn't get it... Why would anyone write $x =~ 0? The code I wanted was $x= ~0. It is just the flip side to what you are asking for: There are already enough ambiguities. (And I found it mildly amusing.)

            - tye (but my friends call me "Tye")