Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 chanting in the Monastery: (4)
As of 2021-10-23 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (88 votes). Check out past polls.

    Notices?