== compares numbers, but you are feeding it strings. Use eq.
perlop
In reply to Re: Random number in while loop by ikegami in thread Random number in while loop by marto9