title: How to get number of entries in a hash with values less than n?
body: <p>Below I use <code>$size = keys %prices;</code> to get the total number of entries in a hash. However, is there a way in the example below to get the number of entries with price less than $4?</p>
  <pre><code>use strict;
  
  my %prices;
  
  # create the hash
  $prices{'pizza'} = 12.00;
  $prices{'coke'} = 1.25;
  $prices{'sandwich'} = 3.00;
  $prices{'pie'} = 6.50;
  $prices{'coffee'} = 2.50;
  $prices{'churro'} = 2.25;
  
  # get the hash size
  my $size = keys %prices;
  
  # print the hash size
  print &quot;The hash contains $size elements.\n&quot;;
  </code></pre>