Can't call method "next_hit" on an undefined value at read_blast_stats.pl line 150, line 253 (#1) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "next_hit" on an undefined value at read_blast_stats.pl line 150, line 253. at read_blast_stats.pl line 150