in reply to Re: Filtering Output from two files
in thread Filtering Output from two files
Hello this works for a program with less lines i.e 10. However when i run it on a big file say about 700k lines nothing happens. Any idea what can be causing this?#!/nairvigv/bin/perl use strict; use warnings; use Data::Dumper; my $file1 = 'BBIDs.txt'; my $file2 = 'fixedincomeTransparency.out.px.derived.updates'; #reading file1 into a hash my %hash; my @fields; open (my $fh,'<',$file1) or die $!; while(my $line=<$fh>) { chomp $line; next if $line =~ /^\s*$/; $hash{$line}=1; } #print Dumper(\%hash); close $fh; open (my ($fh2),$file2) or die $!; while (my $row = <$fh2>) { chomp $row; print "$row\n"; next if $row =~ /^\s*$/; my (@fields) = split(/\|/, $row); print "$fields[0]\n "; if (exists $hash{$fields[0]}) { print "$row\n"; } } close $fh2; ~
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Filtering Output from two files
by LanX (Saint) on Feb 06, 2018 at 11:48 UTC | |
by vighneshmufc (Acolyte) on Feb 06, 2018 at 12:25 UTC | |
by LanX (Saint) on Feb 06, 2018 at 12:39 UTC | |
by vighneshmufc (Acolyte) on Feb 06, 2018 at 15:52 UTC | |
by hippo (Archbishop) on Feb 06, 2018 at 16:36 UTC |