11 my ($ingr, $al) = /\A([^\(]+) \(contains (.*)\)\z/;
12 my %ingr = map { $_ => 1 } split /\s+/, $ingr;
13 my @al = split /, /, $al;
15 if (defined $allergens{$al}) {
16 for my $in1 (keys %{ $allergens{$al} }) {
18 delete $allergens{$al}->{$in1};
22 $allergens{$al} = { %ingr };
25 for my $in (keys %ingr) {
26 $ingredients{$in} = {};
31 for my $al (keys %allergens) {
32 for my $in (keys %{ $allergens{$al} }) {
33 print "$in can be $al.\n";
34 $ingredients{$in}->{$al} = 1;
39 for my $in (keys %ingredients) {
40 if (keys %{ $ingredients{$in} } == 0) {
41 # print "$in can't contain allergen\n";
42 $sum += $in_count{$in};