[ For reference, the OP is asking a simpler version of a
question he asked previously. ]
I am trying to make sure that all host-aliases that exist in file1 also exist in file2.
Put differently, you want to know if there's a host-alias in file1 that doesn't exist in file2. (It's often convenient to convert questions that use "all" into questions that use "each".)
Load up the host-aliases from file2. Store them in a hash keyed by the host-alias for ease of lookup. The value doesn't matter. (I'd use something true like 1.)
Then iterate through the host-alias in file 1. For each host-alias you find in file1, check if it's in file2 (by checking if it's in the hash).
You can stop iterating as soon as you find one that's missing and still satisfy your spec, but you might want to continue iterating to find all the missing host-aliases.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.