Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: ignore duplicates and show unique values between 2 text files

by choroba (Abbot)
on Apr 29, 2013 at 15:04 UTC ( #1031228=note: print w/ replies, xml ) Need Help??


in reply to ignore duplicates and show unique values between 2 text files

The reason of your problem is the newline character. It is considered a part of the line you read in, but it is not present on the last line in each file. Therefore, '121' plus newline is not the same as '121' without a newline.

Use chomp to get rid of newlines:

while (my $line = <FILE>) { chomp $line; # ...
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: ignore duplicates and show unique values between 2 text files
Download Code
Re^2: ignore duplicates and show unique values between 2 text files
by perlnoobster (Sexton) on Apr 29, 2013 at 15:09 UTC
    Hi Choroba, I have updated the script however my output still does not show the desired results, it show:
    'def' 'xyx' 'def' 'abc'
      You should use chomp for the second file handle, too.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2014-07-11 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (220 votes), past polls