note
azatoth
<p>And as a side-note, something I learned the other day for error handling in <code>system</code> calls :</p>
<code>
system("/usr/bin/scp $file $username\@$host:$remoteFile");
die "System call to scp command failed! : $!\n" if ($? != 0);
</code>
<p>The special variable $? returns a boolean value for success or fail on system calls.
So the above snippet performs a reliable "or die" check on your command. A handy one to know,
especially as <code>system</code> tends to be a little <i>un</i>reliable in terms of error checking / return values when using a straight [die], IMHO.<p>
<p><b>Update:</b> as per comments below, not a "boolean" in the strict sense of the word. Call it an "azatoth boolean" :)</p>
<p><font color="#0000ff">Azatoth a.k.a Captain Whiplash</font></p>
<!--remember! der blitz ist auf der flachmahtuche. always.-->
<A HREF="/index.pl?node_id=62730&lastnode_id=1072">Make Your Die Messages Full of Wisdom!</a><br>
<A HREF="/index.pl?node_id=52502&lastnode_id=1072">Get YOUR PerlMonks Stagename here!</a><BR>
<A HREF="/index.pl?node_id=55997&lastnode_id=1072">Want to speak like a Londoner?</a>
94035
94064