Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Array reference of hash references

by Util (Priest)
on Oct 25, 2011 at 22:45 UTC ( #933726=note: print w/ replies, xml ) Need Help??


in reply to Array reference of hash references

Initialize an array with parens (or not at all), *not* with square brackets.

perl -MData::Dumper -wle 'my @official = []; print Dumper \@official;' $VAR1 = [ [] ]; perl -MData::Dumper -wle 'my @official = (); print Dumper \@official;' $VAR1 = [];
Also, declare @official outside the while loop. Otherwise, you are re-initializing it on each loop.


Comment on Re: Array reference of hash references
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2015-08-28 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (334 votes), past polls