Hello again, SayWhat?!,

Good job on clarifying the question. I’m getting some idea of what you want to achieve. However, from your statement:

I want the matching lines to be written to OutputFalseFriends.txt, and the non-matching lines to be written to OutputUnsortedWorldList.txt

I would not expect the second output file to contain the line goed braaf, since this appears in both the input files. Is this a mistake, or am I missing something?

(Incidentally, a large part of ‘programming’ is really sorting out requirements, independently of the actual code. This is just something we all need to get used to.)

I think that, if you re-examine your code in light of your sample input, you will see that the requirements have evolved. For example, as RichardK observes, there are no commas, etc., to be cleaned up. Also, %hash is not being used for anything. Rather than fix your main loop — the loop beginning while (<BILWL>) — it will probably be easier if you re-think the logic of what you are doing and re-write this part from scratch.

flexvault has given some excellent advice. In addition, it will help you if you include the line:

use autodie;

near the top of your script, as this will tell you when files cannot be opened, etc. Also, if you:

use Data::Dumper;

this will make the debugging task easier. (Data::Dumper is a core module, so it will already be in your Perl installation. See http://perldoc.perl.org/Data/Dumper.html for details.) For example, you can print the contents of %falsef with just:

print Dumper(\%falsef);

You’re making progress!

Athanasius <°(((><contra mundum


In reply to Re^3: Comparing / Searching through Hashes by Athanasius
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.