Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://591303]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-11-21 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (305 votes). Check out past polls.

    Notices?