while ($n = int (rand 6) ){ print 6-$n,"\n"; $count++; } print "6\nTried ",1+$count," times.\n";