comment vérifier si un hachage de référence est vide en perl

J'ai besoin de tester, si mon hashref contient 0 éléments.
J'ai utilisé ce code:

$self = { fld => 1 };
%h = ( "a" => "b" );
$self->{href} = { %h };
print STDERR $self->{href}{ "a" };
print STDERR "\n";
print "size of hash:  " . keys( %h ) . ".\n";
print "size of hashref:  " . keys( $self->{href} ) . ".\n";

Il fonctionne bien avec perl 5.16, mais échoue avec perl 5.10:

Type of arg 1 to keys must be hash (not hash element) at - line 7, near "} ) "
Execution of - aborted due to compilation errors.
InformationsquelleAutor basin | 2013-04-30