<UPDATED 5/1> I gave it a try, but it doesn't seem to do what I want it to do. Please have a check at my script down there.


Hello there, I'm quite new to using Perl and I'm learning it at work. Would be nice if you could help me on that one. I handle dictionary data and I have to write a script that checks if words in data corpus exists or not in a word-list file. If it exists, it has to do nothing but if it doesn't, I want it to print that word.

The point is, I have to NOT use hashes or grep to look for the presence. And to make it as fast and efficient as possible. It's part of my learning.

So first, I open the word-list file (one word per line format), I push each word in an array and close the file. Then I use sort to sort alphabetically the array.

I then open the corpus data (also one word per line), and it's there that I'm stuck. If I could use grep or hashes, it would already be over, but I can't. So what should I do ?

Any help is welcome.

In reply to Check word presence WITHOUT hashes or grep by gojippo

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.