Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: List into two-dimensional array

by choroba (Cardinal)
on Dec 14, 2020 at 19:14 UTC ( [id://11125184]=note: print w/replies, xml ) Need Help??


in reply to List into two-dimensional array

In the spirit of TIMTOWTDI:
my @AoA; for (0 .. $#list) { push @AoA, [] if $_ % $C == 0; push @{ $AoA[-1] }, $list[$_]; }

or, without using indices:

my @AoA = []; for (@list) { push @AoA, [] if $C == @{ $AoA[-1] }; push @{ $AoA[-1] }, $_; }
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 21:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found