Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: issue with print/join 2 arrays

by RichardK (Parson)
on Apr 29, 2014 at 17:08 UTC ( #1084357=note: print w/replies, xml ) Need Help??

in reply to issue with print/join 2 arrays

But what should happen when the length of the first array isn't a multiple of 3?

Replies are listed 'Best First'.
Re^2: issue with print/join 2 arrays
by juanito23 (Novice) on Apr 29, 2014 at 18:37 UTC
    Hi!, thanks for all replies, but yes.. The arrays I will have to print have more than 1000 rows per 3 columns... Any way to do it then? One other thing.. What if the length of both arrays are different? Thanks!!

      Just adapt the solution I gave in my other post:

      say join ' ', map splice( $_, 0, 3 ), \@array1, \@array2 while @array1 or @array2;

      If you need to access your original arrays later, make copies and destroy these instead.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084357]
[1nickt]: This is less than perfect ... but demanding perfection (from people or from life) is a sure way to unhappiness.
[Discipulus]: and anyway we have CB where every (democratic) opinion can be expressed
erix eat the rich!
[1nickt]: I do think it is sad that roho has received 3 downvotes for his polite request, as did I when I objected to the profanity in stonecolddevin's sig. I upvoted both him and Karl for the discussion. Way too much downvoting for inappropriate reasons here!
Discipulus learn that 'argue' has a little negative sense, he thought was a neutral sense, 'vox media'
[1nickt]: argue == discuss && argue == be contentious
[Discipulus]: you are right 1nickt i didnt voted nor downvoted; I just upvote perl content i like
[1nickt]: In Spanish, to argue (like a fight) is discutir -- does not mean to discuss !
[1nickt]: Sigh, this is why I gave up human-only languages and became a Perl linguist :-)
[Discipulus]: i just, rarely, downvote unpolite posts and spam, and wrong advices

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-06-22 12:21 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (519 votes). Check out past polls.