I don't fully understand your question, but I first notice that your program as it is written, should not find any matching line in your log. The reason is that you are using
to check for the interesting lines. $_ certainly will never be exactly the string has gone down, because at least it will have a \n at the end, plus, according your description, it has some more information in this line (such as the timestamp).if($_ == "has gone down" ) { ... }
If you are only interested in lines containing that magin string, the easiest way would be to use index. Note that index returns -1 on failure.
If you need, however, some of the other fields in the logline as well, in order to run your start server command, you are better of using regular expressions. For example if you need the server name and port, you could write something like
if(/Server\s(.+):(\d+) has gone down/) { my $server=$1; my $port=$2; ... }
In reply to Re: creating a perl script
by rovf
in thread creating a perl script
by scott_apc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |