Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: convert rows to columns

by McA (Priest)
on Nov 26, 2012 at 12:47 UTC ( #1005635=note: print w/ replies, xml ) Need Help??


in reply to convert rows to columns

Hi,

there is something which jumped into my eye: The index of an array runs from 0 to scalar(@array) - 1, so you have to adjust the condition of your for loop.

Best regards
McA


Comment on Re: convert rows to columns
Replies are listed 'Best First'.
Re^2: convert rows to columns
by ack (Deacon) on Nov 26, 2012 at 20:35 UTC

    I saw that, to. Also, you can't push to a sigle element of an array that I'm aware of. You have to push to an array. So the line push $arr[$cnt], $xox[$i]."".$xox[1+$i] I believe won't work. You need something like push @arr, $xox[$i]."".$xox[1+$i].

    ack Albuquerque, NM
      In recent Perl (since 5.14), you can push to an array reference. It is not autovivified, though; therefore,
      perl -e '$x[0] = []; push $x[0], 1'
      works, but
      perl -e 'push $x[0], 1'
      does not.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2015-07-28 22:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (260 votes), past polls