develooper Front page | perl.beginners | Postings from February 2009

strange string match

Thread Next
org chen
February 15, 2009 17:32
strange string match
Message ID:

I am coding a script to read a pure txt fiel and show it. I can't understand why any lines in the file match the word of "[DIED]".
------------------------------------------------the txt file is like this:
Fri Feb 13 14:31:26 2009[PROCESS]: Welcome to our system![ERROR]: Please check step 1![SUCCESS]: all done! enjoy the data!
---------------------------------------My code is: ...
        while(my $line = <>){                chomp( $line );                        print "<p>current line is $line";
                if($line =~ /^[Mon|Tue|Wed|Thu|Wed|Fri|Sat|Sun]/){                        #push old data into array                        print "<p>time: $line";                }                elsif($line = ~ /\[DIED\]/){                        print "<p>DIED: $line ";                }                elsif($line =~ /\[SUCCESS\]/){                        print "<p> success:$line";                }                elsif($line =~ /\[PROCESS\]/){                        print "<p>process: $line";                }        }
-------------------------------------------the result is:
Current line is Fri Feb 13 14:31:26 2009time: Fri Feb 13 14:31:26 2009current line is [PROCESS]: Welcome to our system!DIED: 18446744073709551615 current line is [ERROR]: Please check step 1!DIED: 18446744073709551615 current line is [SUCCESS]: all done! enjoy the data!DIED: 18446744073709551615 
Get the most out of your life online! Click here for the latest news and tips.
Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About