$max_size = 5; @array = (0) x $max_size; # put $max_size zeros in array # process file here.. for ( $i = 0; $i <= $#array; $i++ ) { # now set the value to lost if it is still zero $array[$i] = "$i.lost" unless ( $array[$i] ); }