in reply to iterating through a hash?
use strict; use warnings; open my $fh, '<', $FILE2 or die "Can't open file2: $!\n"; my %hash = map split, <$fh>; open $fh, '<', $FILE1 or die "Can't open file1: $!\n"; while ( <$fh> ) { my ( $k, $v ) = split; my $ok = ( defined $hash{$k} and $hash{$k} == $v ) ? 'OK' : 'WRONG' +; print join( "\t", $k, $ok, $v ), "\n"; }
Update: Output, as per spec (tabs being equal):
peter WRONG 1234 nick OK 1111 john WRONG 4567 mike OK 3333 george OK 2222 antony WRONG 5632 migel WRONG 1209
|
|---|