in reply to Extracting BLAST hits from a list of sequences

I know nothing about BLAST files, but it's probably because

my $blastcut = substr $blastline, 7;

is sometimes an empty string. Maybe do something like this:

if ($blastline =~ /$ender/ && $headerline =~ /\Q$blastcut\E/) {

or this:

my $printing = 0; while (<BLASTFILE>) { if (/Query=\s*(.*)/) { $printing = (index($headerline,$1) >= 0); } print if $printing; }