while () { ($col1, $col2) = split m/\s+/; for $file (keys %files) { if (exists $files{$file}{$col2} ) { .....do something.... } } }