Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by choroba (Chancellor)
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; # ...
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
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?
[Corion]: The bots bow in response
[Discipulus]: so karlgoethebier, what this idiom is and where i can read about it? i tried to deparse and gives error..;=(
[karlgoethebier]: Eily: non-people == persone non grata?
[Your Mother]: Corion: I have lost the link to the pmdev guide(s). Do you have that handy?
[karlgoethebier]: Discipulus: see per lop please how to avoid the classic <c>perl dangerous.pl 'rm -rfv *|'</>
[Eily]: karlgoethebier: more like grata non persona :P

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2017-07-21 08:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.