#!/usr/bin/perl -w use strict; open(FH, "table") or die "Can't open file to read!: $!\n"; for my $i (2..682) { while () { chomp; my @matrix = split; my $seed = $matrix[$i]; if ($seed !~ /[ACGTN-]/) { print "P$i "; last; } } seek FH, 0, 0; } close FH;