my %h1; while () { $h1{$1} = $2 if /^(\d)+\s+(.+)/; } while () { /^(\d)+\s+(.+)/; printf "Match: %s\t%s\n", $1, $2 if exists $h1{$1};