..I only need to print those unmatched data shown as expected result.. use negation not like so:
...
while (<DATA1>) {
next if /^\s*$/;
if (/^.+?\s(.+?)\s/) {
print $_ if not exists $hash{$1}; # note HERE
}
}
..
Could you please explain further about hash? See perlintro
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
| [reply] [d/l] [select] |
(not necessarily to 2teez) Be aware that (see perlop's precedence table) the use of not here means that the entire clause on the right side is negated. You can also use ! to just negate the next closest term.
I often give the advice to use (and, or, not) for flow control, and (&&, ||, !) for logic. In this case I am not taking the position that this use of not is incorrect, just that it is important for the OP to be aware of what it is actually saying.
Update: As ambrus stated in the CB: "How about unless".
| [reply] [d/l] [select] |