| -----Original Message-----
| From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
| Sent: Monday, September 10, 2001 3:36 PM
| To: [EMAIL PROTECTED]
| Subject: Re:If always verified
|
|
| Hi, I have this code:
|
| tie *FILE,'File::ReadBackwards', 'c:\\cygwin_syslog.txt'
| or die "Can't read logfile.txt: $!";
| $lastline = <FILE>;
| if(defined $lastline and $lastline =~ /$success/)
| {
| ......
| }
|
| The if statement is always verified even the last line don't
| end with success.
|
| Why?
I guess you wanted to write $lastline =~ /success$/.
Perl interpolated the (likely non-existent) variable $success, so you
matched against the empty string. (Which is hard not to succeed ;-)
Turn your warnings on: #!/bin/perl -w
-- Marcus
|
| --
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]