in reply to fixing Perl's inconsistencies

Heh. Yesterday I wrote $x=~0;.

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

Replies are listed 'Best First'.
Re: (tye)Re: fixing Perl's inconsistencies
by japhy (Canon) on Feb 20, 2001 at 22:23 UTC
    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

      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")