Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Thoughts on replacing -> with .

by Ralesk (Pilgrim)
on Jun 12, 2013 at 11:27 UTC ( #1038435=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Thoughts on replacing -> with .
in thread Thoughts on replacing -> with .

Hmm, I don’t see ~= in perlop; and ~ is the unary bitwise negation operator, so it wouldn’t make much sense to have ~=. What is it?


Comment on Re^3: Thoughts on replacing -> with .
Select or Download Code
Replies are listed 'Best First'.
Re^4: Thoughts on replacing -> with .
by Corion (Pope) on Jun 12, 2013 at 11:32 UTC

    It is like += and .=, which modify the left-hand side by the right hand side.

    $a += $b adds the right hand side ($b) to the left hand side, $a, and assigns the result to $a.

    $a .= $b appends $b to $a and assigns the result to $a.

    $a ~= $b xor's $b and $a and assigns the result to $a.

    As this is a relatively uncommon use, it maybe makes this interchange currently even harder to spot than later the use of =~ and ~=.

      But XOR-assign is supposed to be $a ^= $b...

      I am getting a syntax error for
      $a ~= $b
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        Err - yes. I wonder how I came to this interpretation and I'm sorry I did not test it before...

        Correct. On the other hand, :$ ~= $b does work, but is has nothing to do with XOR.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1038435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (19)
As of 2015-07-31 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls