Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Read array of arrays in reverse order

by nvivek (Vicar)
on Apr 19, 2010 at 03:14 UTC ( #835384=note: print w/replies, xml ) Need Help??

in reply to Read array of arrays in reverse order

Following script also does the job.Normally in Perl,array indexes starts from 0.
use strict; use warnings; my @my_arr = ( [1, 11, 0, 0], [12, 109, 0, 0], [16, 1, 16, 0], [14, 14, 2, 0], [45, 16, 5, 4], ); my $index=$#my_arr; while($index) { push @diagonal,$my_arr[$index][$index-1]; --$index; }
print join '-', @diagonal;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://835384]
[erix]: oh nice, can do |& nowadays. Learned something new after all
LanX flagelates erix with a signed markov chain
[erix]: oh well, it's holy week, right? Thick-skin week. I just read that in the Philippines, some RCs practice self-crucifixion. Tough cookies I'd like to see
[LanX]: already?
[erix]: I don't know really. I thought so.
[LanX]: April 16th
[erix]: ah no, 16 april. some time to go yet :)
[LanX]: I hate resurrection ... my back aches

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-03-23 08:59 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.