%hash = ( a => 1, b => 2, c => 3 ); %hash = ( a => 1, b => 2, c => 3 ); $s = keys %hash; # scalar context: number of keys # vs. my @a = keys %hash; # list context: keys $t = @a; # array in scalar context: number of items printf "\$s is \$t: %s\n\$s: %s\n\$t: %s\n", $s eq $t ? 'yes' : 'no', $s, $t; printf "\$s is \$t: %s\n", $s eq $t ? 'yes' : 'no'; #### %hash = ( a => 1, b => 2, c => 3 ); $s = %hash; # scalar context: hash stats # vs. my @a = %hash; # list context: key/value pairs $t = @a; # array in scalar context: number of items printf "\$s is \$t: %s\n\$s: %s\n\$t: %s\n", $s eq $t ? 'yes' : 'no', $s, $t;