while (%mthlens=<$fh>) runs only once, no matter how many lines are in your file, because <$fh> is run in list context (ie: it is affected to a hash, which can take several elements in, so all the lines are returned at once to fill those elements).
chomp, as a lot of other Perl function do, works by default on $_ if no argument is supplied. But since you don't affect anything to $_, it's quite useless. If you wanted your lines to be in $_ you could have written either while ($_=<$fh>) or while(<$fh>), and then you would have read line by line. You might want to use another variable instead though, with while (my $line = <$fh>) and then chomp $line.
while ( my ($Janlen,$length,$filename) = each %lengths) doesn't make much sense, each returns a list of two values, so if you affect it to three scalars, the third one will be undef.
Actually running your code under strict and warnings, and not just putting those line at the last moment to avoid being told to do so would help you avoid most of the mistakes you make instead of waiting for an answer here.