What is the origin of $line ?

if you wrote $line = <STDIN> you should remove the "\n" and or "\r\n" at the end of $line.

And if the user enter not numeric value you should always shuch an error.

You should check if the value is numeric or use 'eq' instead of '!=' .

If you removed the "\n" ou "\r\n"
while ( $line eq "99" ){
or
while ( $line eq "99\n" ){
or under win32
while ( $line eq "99\r\n" ){
lerameur a écrit :
Hello and cheers to all,

I wrote a small program and it does work, but I get this error message
every tim I run the script:
Use of uninitialized value in numeric ne (!=) at ./reverse_string.pl
line 11.
basically it is a menu and when the user type 99 as a choice,  the
program ends

line 11 is:
while ( $line != 99){

thanks
ken




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to