- or download this
for(my $x = 0; $x <= $#array; $x++) {
next unless $array[$x];
# do stuff with $x and $array[$x]
}
- or download this
my %hash =
map { $x => $y }
grep { my $y = $list[$x]; $y ne $undef; [$x, $y] }
for(my $x = 0; $x <= $#list; $x++);
- or download this
$list{100} = 'dog';
$list{435} = 'cat';
$list{1040} = 'tax form';
...
while(($index, $element) = each %list) {
# do stuff with $index and $element
}