BEFORE: foreach (my $i=0; $i < scalar(@a); $i++) { $a[$i] = -1 unless (defined $a[$i]); } AFTER: @a = map { defined $_ ? $_ : -1 } @a; Your thoughts? j