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

Re: Multiple assignment in Perl

by bart (Canon)
on Jul 24, 2018 at 06:13 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-19 16:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found