Help for this page

Select Code to Download


  1. or download this
    my @array_of_objects = (
        { sex=>'Male', occupation=>'foo' },
    ...
    $VAR1 = { 'Female' => 3, 'Male' => 2 };
    $VAR2 = { 'Female' => { 'bar' => 1, 'foo' => 2 },
              'Male' => { 'foo' => 1, 'bar' => 1 } };
    
  2. or download this
    sub count {
        my ($data, $fields) = @_;
    ...
    print Dumper( count(\@array_of_objects, 'sex') );
    print Dumper( count(\@array_of_objects,
        ['sex','occupation']) );