use Modern::Perl open trained , 'D://ARP//libsvm-3.12//families//antioxidant//independent.scale'; open predict , 'D://ARP//libsvm-3.12//families//antioxidant//testing.scale'; my $counter = 0; my $lol = 0; select trained; my @train = $_; while () { #print $_; my $predict = $_; if (exists $train{$predict} { print $predict; $counter = $counter + 1 } } print $counter;