foreach my $i ( 0 .. $#$array ) { # dereference the element print $array->[$i], "\n"; }