Created
November 4, 2012 03:14
-
-
Save yongbin/4009964 to your computer and use it in GitHub Desktop.
simple.pl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # http://twitter.com/ditto572/status/264921423112458240 | |
| # | |
| # perl -MBytes::Random::Secure=random_bytes_base64 -E 'print random_bytes_base64(32) for ( 0 .. 120000)' > list | |
| # perl -MBytes::Random::Secure=random_bytes_base64 -E 'print random_bytes_base64(32) for ( 0 .. 50000)' > list2 | |
| use strict; | |
| use warnings; | |
| my %h; | |
| { | |
| open my $fh, '<', 'list1' or die; | |
| $h{$_}++ while (<$fh>); | |
| close($fh); | |
| } | |
| { | |
| open my $fh, '<', 'list2' or die; | |
| while (<$fh>) { | |
| print unless exists $h{$_}; | |
| } | |
| close($fh); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
real 0m0.610s
user 0m0.246s
sys 0m0.113s