Hello, i cannot fully understand your requirements, given the two example files; can you rephrase?
Some observations:
- where is use warnings;?
- do not use uppercase variables names
- also rembember to close your filehandles anyway: it is safer.
- chop is not chomp
- Avoid a or b as variable name: the scalar form are special variables and even if the hash is not, avoid it anyway. Instead choos meaningfull variables names
- when learning or debugging i think is preferable to write down plain syntaxes: you have a superfluous bare block: why? the syntax inside it is not so begenner's one. How can inpsect it without a place where insert the basic debugging tool aka print?
#{
# print "$_\n" for grep {$_} @a{keys %b};
#}
#
# should be something like (untested..)
foreach my $bkey (keys %b) {
warn "key not defined" unless $bkey; ## what is the purpose of you
+r "grep {$_}"???
if ($a{$bkey}){print "FOUND: [$bkey] in the hash \%a\n"}
else{print "NOT found key [$bkey] in the hash \%a\n"}
}
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
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.