in reply to Re^2: Perl: How to print unmatched data after comparison of two files?
in thread Perl: How to print unmatched data after comparison of two files?

..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

Replies are listed 'Best First'.
Re^4: Perl: How to print unmatched data after comparison of two files?
by MidLifeXis (Monsignor) on Jul 17, 2013 at 12:33 UTC

    (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".

    --MidLifeXis

Re^4: Perl: How to print unmatched data after comparison of two files?
by WWq (Novice) on Jul 17, 2013 at 09:21 UTC
    Thanks a lot 2teez :)