my $wordlist = 'wordlist.txt'; if (! -s $wordlist) { print "File is empty\n"; exit 0; } # NO ELSE HERE! # your code goes here