Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: a one-liner for this trivial problem?

by space_monk (Chaplain)
on Apr 16, 2013 at 17:09 UTC ( #1028963=note: print w/ replies, xml ) Need Help??


in reply to a one-liner for this trivial problem?

This solution is just if you really insist on using Perl; the Re: a one-liner for this trivial problem? suggestion using grep is better....

perl -pie ' BEGIN { open $fh, "<" , "littlefile" or die "Cannot read file"; our %hash = map { $_ => 1} <$fh>; } print if not $hash{$_}; ' < bigfile

All the above will go on one line. any minor bugs are your problem (chomps may be needed for example) :-)

A Monk aims to give answers to those who have none, and to learn from those who know more.


Comment on Re: a one-liner for this trivial problem?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2014-10-01 21:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (38 votes), past polls