in reply to Tail a log, then match its string

Try to change:
my $tail = system("tail -1 /var/log/ping_10.10.0.100.sj");
to:
my $tail = qx(tail -1 /var/log/ping_10.10.0.100.sj);
qx captures the output of the tail command into a variable; system does not. system returns the exit status of the command, which is 0 if the command succeeded. That is why you can match 0.

Please update your node and use code tags around your data and code: see Writeup Formatting Tips

Replies are listed 'Best First'.
Re^2: Tail a log, then match its string
by perl_zen_noob (Initiate) on Feb 24, 2010 at 03:38 UTC

    Thanks for the quick replies. Wow, I'm ashamed to admit that I had been fighting this for 3-4 days. Within minutes, toolic solved it. Thanks a million. I'll sleep well tonight.

    And I promise that all future posts will be formatted better.