while (my $foo = <$fh>) { #do something } while (my ($key, $value) = each %hash) { #do other things }