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