in reply to File handle question

Once you step through a file, you need to rewind it (if possible) to read through it again. Your first loop steps through the file to the end, so the second loop doesn't have any lines to step over.

You can either reopen FCMP, or rewind it to position 0:

# open/reopen my $filename = "anchor.txt"; open FCMP, "<", $filename or die "Couldn't open '$filename': $!"; # or, alternatively seek FCMP,0,0; # rewind