This is starting to bother me. I wrote up a perl script and what I had wanted to do was this
$down="false";
open (FH, $log) || $down = "true";
I obviously got an error about trying to mod a scalar value
I found a way to get what I wanted by calling subroutines instead;
use vars qw/$down/;
$down="false";
open (FH, $log) || &woops($host);
if ($down eq "false") {
....send tail of log file...
} else {
....send "server is down"
}
sub woops {
...do some stuff....
$down = "true";
}
I know this may look like a really stupid bit of perl code, I only code perl for my own enjoyment and I've only been doing it since September. What would you folks recommend? Thanks much.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|