Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: I need some wisdom. How do I pack an array to a set length.

by ikegami (Patriarch)
on Nov 23, 2011 at 20:27 UTC ( [id://939731]=note: print w/replies, xml ) Need Help??


in reply to I need some wisdom. How do I pack an array to a set length.

my @a = $x; push @a, @b for 1..$x;
or
my @a = ( $x, map { @b } 1..$x );
or
my @a = ( $x, (@b) x $x );

The inner parens are required since "()x" is different than just "x".

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 02:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found