in reply to Error message while reading from file

the problem is that when the loop reachs the EOF, <EXP> returns undef. Rewrite the loop as:
while(defined(my $line = <EXP>)) { next unless $line =~/\s/; ... }