Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: looping over multidimensional arrays

by haukex (Chancellor)
on Sep 23, 2018 at 08:02 UTC ( #1222880=note: print w/replies, xml ) Need Help??

in reply to looping over multidimensional arrays

I read somewhere that if you are using counters in perl, you are not doing it right

That's probably a bit of an exaggeration to make a point: People coming from other languages will be used to C-style for loops, but often Perl's foreach will do away with a need to use indicies in the first place.

But sometimes you need an index, and there, instead of for (my $i; $i<@a; $i++), the more Perlish ways are for my $i (0..$#a) or, on newer versions of Perl, you can use each.

Note: This is a re-post of a node that was lost.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2019-07-18 03:13 GMT
Find Nodes?
    Voting Booth?

    No recent polls found