#! perl use strict ; use warnings ; $|++ ; my %myhash = () ; while ( ) { my ( $key, $value ) = split ; push( @{ $myhash{ $key } }, $value ) ; } for my $key ( qw/ ni perch shrubbery / ) { if ( $myhash{ $key } ) { print "Found $key on pass 1.\n" ; } } for my $key ( qw/ ni perch shrubbery / ) { if ( $myhash{ $key } ) { print "Found $key on pass 2.\n" ; } } __DATA__ foo 1 bar 2 zoot 3 perl 4