Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (30 sloc) 670 Bytes
#!/usr/bin/env perl
use strict;
use warnings;
use v5.22;
use Data::Dumper;
my $cat2koban = {
name => 'cat2koban',
favorite_foods => [qw/ sushi niku ramen onigiri /],
};
my $nissy = {
name => 'nissy',
favorite_foods => [qw/ sushi niku /],
};
my $codehex = {
name => 'codehex',
favorite_foods => [qw/ sushi ramen /],
};
my @people = ($cat2koban, $nissy, $codehex);
foreach my $int (@people){
my @favorite_foods = @{$int->{favorite_foods}};
print Dumper(@favorite_foods);
}
my %ranking;
foreach my $person (@favorite_foods) {
my $fav = $person->{favorite_foods};
foreach my $food (@{$fav}) {
$ranking{$food}++;
}
}
print Dumper ($ranking);