Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^5: Referencing/returning array of hashes from sub

by chromatic (Archbishop)
on Jun 08, 2011 at 21:23 UTC ( #908789=note: print w/replies, xml ) Need Help??


in reply to Re^4: Referencing/returning array of hashes from sub
in thread Referencing/returning array of hashes from sub

although I'm not sure why

Array assignments are greedy, just as other people have said. How is Perl to know that in:

my (@date, @F_SCORE, ...) = (@$date_ref, @$F_SCORE_ref, ...);

... @date should only slurp up the elements from the flattening of @$date_ref into a list? By the time the assignment occurs, Perl has forgotten how many elements $date_ref contained.

By the way, as I wrote before, there's no obvious and particular need to perform this copying operation. It's probably just busy work. If you're having trouble figuring out how to work with references in place, ask away and we'll help you figure out how to avoid it.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2022-08-14 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?