CPU: Perl, Fall 2005 Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables #51

Does a Hash Have Items?

my %hash;
if ( %hash ) { print "marmot\n" }
$hash{"foo"} = "bar";
if ( %hash ) { print "hamster\n" }
Copyright © 2005 Ian Langworth