Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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
Domain Nodelet?
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 scrutinizing the Monastery: (3)
As of 2023-02-08 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (44 votes). Check out past polls.

    Notices?