H
Huey
Hi All,
Merry Xmas! I wonder somebody would work at this moment, but this
simple problem just drives me nuts! How can a chop function fail? I
simply read from a text file, and need to clean up the newline char
with chop, but failed! My simply code:
#!perl
# records in file foo.txt is like "me:123\n"
open (F, "./foo.txt");
while (<F>) {
($u, $p) = split(/:/, $_);
chop $p;
if ( $p eq "123" ) {
print "got ya!", "\n";
}
}
close(F);
I am using cygwin perl. I noticed $p looked correct in command-line
when printed. The problem is the if () test never go true, it means
that $p never equals "123", and chop never worked! Aha! Funny? Anybody
ever experienced such a thing? Please give me your solution, thanks a
lot!
Huey
Merry Xmas! I wonder somebody would work at this moment, but this
simple problem just drives me nuts! How can a chop function fail? I
simply read from a text file, and need to clean up the newline char
with chop, but failed! My simply code:
#!perl
# records in file foo.txt is like "me:123\n"
open (F, "./foo.txt");
while (<F>) {
($u, $p) = split(/:/, $_);
chop $p;
if ( $p eq "123" ) {
print "got ya!", "\n";
}
}
close(F);
I am using cygwin perl. I noticed $p looked correct in command-line
when printed. The problem is the if () test never go true, it means
that $p never equals "123", and chop never worked! Aha! Funny? Anybody
ever experienced such a thing? Please give me your solution, thanks a
lot!
Huey