in reply to iterate through two-dimensional array

TIMTOWTDI

DB<102> $var_ref_array = [ [5349, 5350, 6205], [5355, 5356, 1777741, 1777742], [5699, 1792850, 1792851], ] DB<103> for my $a1 (@$var_ref_array) { for my $a2 (@$a1) { print "$a2\t"; } print "\n"; } 5349 5350 6205 5355 5356 1777741 1777742 5699 1792850 1792851

if you need indeces you can still manually increment something like $i and $j.

There should also be an each ARRAY solution to get index and value simultaneously but my Perl is too old. :)

Cheers Rolf

(addicted to the Perl Programming Language and ☆☆☆☆ :)

Replies are listed 'Best First'.
Re^2: iterate through two-dimensional array
by fionbarr (Friar) on Sep 24, 2014 at 21:04 UTC
    thanks very kindly