Help for this page

Select Code to Download


  1. or download this
        $num_keys = scalar keys %hash;
    
  2. or download this
    $number = grep(//, keys %hash);
    
    for (keys %hash) { $number++; }
    
  3. or download this
    
    ## Find the number of elements that are defined:
    ...
    ## Find the number of elements where the key equals the value:
    $number = grep($_ eq $hash{$_}, keys %hash);