Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by haukex (Bishop)
on Mar 02, 2017 at 07:25 UTC ( #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? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2021-09-26 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?