Read and validate 

my @numbers;
while(<$fh>) {
    if(/^(\d{8})$/) {
        push @numbers, $1;
    }
}