use strict; print "\n"; my @frau = qw /bl ge gr br sw rt/; my @mann = qw /ge bl bl br sw rt/; my %fr = map { $_, 1 } @frau; my %ma = map { $_, 1 } @mann; for (keys %ma) { $paar++ if exists $fr{$_}; } print "FIFO Paare: $paar\n"; my %h = (); # der kleine Helfer ;) @h{@frau} = @mann; # slice my $anz = grep{ $h{$_} eq $_ }keys %h; print "rosti Paare $anz\n"; my %people; my @paare; $people{$_}->{f}++ for(@frau); $people{$_}->{m}++ for(@mann); while(my($k,$v)=each(%people)) { push(@paare,$k) if($v->{m} && $v->{f}); } print "topeg Paare:".join(',',@paare)." = ". @paare. "\n";