Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to declare arrays and scalars together?

by ikegami (Pope)
on Jun 18, 2012 at 05:17 UTC ( #976751=note: print w/ replies, xml ) Need Help??


in reply to How to declare arrays and scalars together?

First, ( (),(),"0", () ) is the same as "0".

Second, no matter what list the right-hand side of the assignment returns, nothing will ever be assigned to $var. Everything will be assigned to @arr1. There's no way for the assignment to know how many elements of the list should be assigned to @arr1, how many to @arr2, etc.

If you're not assigning anything to more than one array, you can do what you want by moving the scalars to before the arrays.

my ($var, @arr1, @arr2, @arr3) = "0";


Comment on Re: How to declare arrays and scalars together?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-11-24 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (147 votes), past polls