Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Getting individual lists from a bigger list

by sundialsvc4 (Abbot)
on Jul 05, 2013 at 02:11 UTC ( #1042566=note: print w/ replies, xml ) Need Help??


in reply to Getting individual lists from a bigger list

You need to push a reference to the sublist onto the bigger list, taking care, as noted, that Perl does not “flatten” them.   (Data::Dumper is your best friend.)

The reason why references are needed is that, in the end, all of these data structures are one-dimensional.   If @biglist is supposed to contain, say, 5 sublists, then it will then be a list containing 5 entries, each one of which is a reference to its own separate list.

There are, as noted, several ways to build the final structure, and Data::Dumper is quite smart about printing out what it actually sees.   Create a tiny stand-alone test case to prove your logic.


Comment on Re: Getting individual lists from a bigger list

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2014-12-27 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls