Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Syntactically cool list of lists

by tsee (Curate)
on Dec 22, 2006 at 11:46 UTC ( #591303=note: print w/ replies, xml ) Need Help??


in reply to Syntactically cool list of lists

Somehow, my contribution to this was lost. I quietly suspect the fault is sitting in front of the keyboard and it's all related to the preview-button.

Hence I write this again. This solution has the added benefit of trivially supporting partitions other than two per sublist. Autovivification++!

my @a = (1..21); my @b; push @{$b[$_/2]}, $a[$_] for 0..$#a;

Cheers,
Steffen


Comment on Re: Syntactically cool list of lists
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-08 08:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls