Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: SQL like query over iterable in perl (updated x2)

by haukex (Archbishop)
on Mar 02, 2017 at 07:25 UTC ( [id://1183355]=note: print w/replies, xml ) Need Help??

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']) );
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1183355]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-28 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found