Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 rifling through the Monastery: (9)
As of 2014-08-20 21:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (124 votes), past polls