open (M, "|more") || die "Could not open more!\n"; #### chomp,@_=split(/::/),($e{$_[0]},$l{$_[0]})=($_[1],0)while(<>); for (keys %l) { $l{$_}++; @L=grep{($l{$_}==0)}keys%l; $x=int rand(@L); $l{$L[$x]}++; $l{$_}--; print "$e{$_} has a KK of $L[$x]\n"; } #### A::aaron B::bob C::cindy #### %type test.txt | perl kk2.pl aaron has a KK of B bob has a KK of A cindy has a KK of