Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^4: Thoughts on replacing -> with .

by Corion (Pope)
on Jun 12, 2013 at 11:32 UTC ( #1038437=note: print w/replies, xml ) Need Help??


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

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 ~=.

Replies are listed 'Best First'.
Re^5: Thoughts on replacing -> with .
by Ralesk (Pilgrim) on Jun 12, 2013 at 11:38 UTC

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

Re^5: Thoughts on replacing -> with .
by choroba (Bishop) on Jun 12, 2013 at 11:38 UTC
    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://1038437]
help
Chatterbox?
[1nickt]: Mpph didn;t have twins bu I remember thinking that the "terrible twos" was a misnomer as age 4 seemed to be much more difficult.
LanX 4 kids and wanting to upgrade to 5? wow! ! !
[1nickt]: My lads are 15 and 31 now and both drive me just as crazy as when little, just less frequently.
[LanX]: ;p
[marto]: LanX I'd rather commit sudoku :P
[marto]: trench humour folks, feeling rough.
[marto]: there is never a night when they sleep all the way through, but last night was something else
[marto]: gave in at 3:45 ish and let Charlie watch videos about spitfires, the battle of Britain. He's plane crazy

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-11-18 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?