Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Multiple assignment in Perl

by bart (Canon)
on Jul 24, 2018 at 06:13 UTC ( #1219156=note: print w/replies, xml ) Need Help??


in reply to Multiple assignment in Perl

In Perl, the "," operator has a lower precedence than "=". Therefore, your version means
$a, $b = $b, $a + $b
which does, practically speaking, nothing.

You have to add parens to enforce the proper precedence.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2020-06-01 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?