Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Compare two txt files and print the difference between the two files.

by 7stud (Deacon)
on Feb 02, 2013 at 02:33 UTC ( #1016633=note: print w/ replies, xml ) Need Help??


in reply to Compare two txt files and print the difference between the two files.

use strict; use warnings; use 5.012; my $fname = 'a.txt'; open my $afile, "<", $fname or die "Couldn't open $fname: $!"; my %a_links; while (my $link = <$afile>) { chomp $link; $a_links{$link} = undef; } close $afile; $fname = 'b.txt'; open my $bfile, "<", $fname or die "Couldn't open $fname: $!"; while (my $link = <$bfile>) { chomp $link; next if exists $a_links{$link}; say $link; } close $bfile; --output:-- http://www.ok.com/test_www.pdf http://www.ok.com/test_345.pdf


Comment on Re: Compare two txt files and print the difference between the two files.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (11)
As of 2014-09-17 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (71 votes), past polls