Thread Arrays: Pärchen zählen
(12 answers)
Opened by hugenyn at 2012-01-28 01:17
So geht es auch:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 #!/usr/bin/perl use strict; use warnings; my @frau = qw /bl ge gr br sw rt/; my @mann = qw /ge bl bl br sw rt/; 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 "Paare:".join(',',@paare)."\n"; |