Re: Use of uninitialized value in numeric ne error
- From: patmarbidon@xxxxxxx (Patmarbidon)
- Date: Sat, 22 Dec 2007 07:55:41 +0100
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
.
- Follow-Ups:
- Re: Use of uninitialized value in numeric ne error
- From: Yitzle
- Re: Use of uninitialized value in numeric ne error
- References:
- Use of uninitialized value in numeric ne error
- From: Lerameur
- Use of uninitialized value in numeric ne error
- Prev by Date: Re: Ragged Hierarchy
- Next by Date: Re: Crypt SQLite
- Previous by thread: Re: Use of uninitialized value in numeric ne error
- Next by thread: Re: Use of uninitialized value in numeric ne error
- Index(es):