in reply to Re: Out of Memory Error : V-Lookup on Large Sized TEXT File
in thread Out of Memory Error : V-Lookup on Large Sized TEXT File
Hi, With a limited information given i have put together a script. Maybe you can use it to improve yours.
use strict; use warnings; open( my $fh, '<', "input.txt" ) or die "Cannot open input file: $!"; chomp ( my @input_data = <$fh> ); close($fh); open( my $frh, '<', "reference.txt" ) or die "Cannot open reference fi +le: $!"; chomp ( my @ref_data = <$frh> ); close ($frh); my @output = map { my $value = $_; grep { $value eq $_ } @ref_data; } @input_data; open ( my $wh, '>', "output.txt" ) or die ( "Cannot open the output fi +le. $!"); print {$wh} $_ for @output; close($wh);
|
|---|