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.