OK, I'm stumped. I have a very simple script that opens a text file
containing 1 item per line. It then reads the text file line by line
and acts on certain lines in a certain way.
The problem is simple, but it has me stumped. I am reading a line and
chomping it to remove the newline. The problem is that it is still
leaving a space even though there is none present in the text file.
Here is a sample code:
Text file:
1
something
2
something
Script:
$scalar = <TEXT>;
chomp ($scalar);
if ($scalar == 1){
do something;
}
The problem is that when I compare the "1" that I picked up from the
text file to 1 it is not giving a true result because I actually have
"1 " in $scalar.
Now, this script worked fine when I was running it under Perl on my
own machine (Windows XP) but when I convert it to CGI and upload it to
my site (Apache run) I start having this problem. I can make it work
if I use CHOP but I know that I shouldn't have to do it that way.
I couldn't find anything that referred to this in my books or on the
web. I hope someone can help!
Thanks
Andy Schafer
.