in reply to Re: Threading two text files
in thread Threading two text files

> if speed matters consider reading both files first, if you put the data of the second into a hash you can check much faster.

like this

use strict; use warnings; use Data::Dump qw/pp/; open my $qqq,"<","qqq.txt" or die "Open qqq failed $!"; open my $exp,"<","exp.txt" or die "Open exp failed $!"; my @exp = <$exp>; chomp @exp; my %qqq; while (<$qqq>) { my ($value,$key) = split /\s+/; push @{$qqq{$key}},$value; } #pp \%qqq,\@exp; print "$_: @{$qqq{$_}}\n" for @exp;

out

a: 1 11 c: 333

Cheers Rolf

( addicted to the Perl Programming Language)