Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 imbibing at the Monastery: (9)
As of 2014-07-22 10:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (109 votes), past polls