Welcome SayWhat?!,

Rather than debug your script for you, I hope I can make some suggestions for you to learn to better debug your scripts. Note: these are suggestions and after some years of doing your own debugging your suggestions could be very different than mine.

If your Perl supports it, use the 3 parameter version of open:

open (my $FALSEF, "<", "FalseFriendsList.txt");
I like how you name your files, and you can do the same with Perl variables, i.e.
my %ExistingFalseFriend; # or my %existing_false_friend; # or my %Existing_False_Friend;
This will help your eyes see exactly what you wanted to emphasize when you look at the code sometime in the future. Also, I define a $Debug variable that I set to the level of debugging
my $Debug = 3; # 0 - production, 1 - minor debugging, 2 .. 9 for + different levels

This leads to what is needed most in your script -- self-help debugging information. For example why not use a 'foreach' on the hash(or array) to see exactly what you just created.

#while the FF input exists while (my $line = <FALSEF> ) { # chomp off the new line chomp $line; # chomp could be part of while statement # increment $line $falsef{$line}++; } ### Now during debugging print to open log file if ( $Debug ) # this could be 'if ( 1==1 )' for testing, your + call { foreach my $key ( sort keys $falsef ) { print $LOG "$key\t$falsef{$key} } }
Now in your debug log file, you may see that you didn't initialize the hash the way you wanted. Again, my suggestion of 'foreach' could have been replaced by a print statement inside the 'while' loop.

In general, I like your style and I'm sure it will get better and better.

Good Luck...Your on your way!

"Well done is better than well said." - Benjamin Franklin


In reply to Re: Comparing / Searching through Hashes by flexvault
in thread Comparing / Searching through Hashes by SayWhat?!

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.