I decided to write a little script to help choose who will make the tea on our gaming night [there is always an argument!]
I thought I was doing quite well but it seems I am picked on by the [non]random script I wrote! It seems to default to the first word in the array. I used rand @array; I think perhaps that I am thinking about it too simply and perhaps I need to involve more math - but I am not good at maths [though I am willing and a quick learner...lol] ! so can anyone point me in the right direction? #!c:/perl/perl.exe @tea = "Meba", "Shaun", "Mark", "Jason", "Rick", "Dan"; #below is the problem area I think - perhaps rand is not appropriate here? #or I haven't phrased it right? #I have looked through masses of documentation and faqs but can't find a thing. #Am I blind or just dim? $get = rand @tea; $who = $tea[$get]; $affirm = "The lucky tea maker is "; $result = $affirm.$who; $fail = "Sorry I wasn't listening. Try again!\n"; print "Enter y to see who will make the tea: "; $input = <STDIN>; chomp $input; if ($input eq "y") { $a= true; } if ($a) {print $result } else { print "$fail" }; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]