Thanks for everyone's response. helgi response makes a lot of sense. I keep forgetting that they are magic variables with super powers.
I guess that the thing that I find really puzzling is how $! and $? act completely different when sudo is thrown into the mix:
$> perl sudotest.pl
Password:
sudo: /foo/bar/paco: command not found
$ sudo /foo/bar/paco
ERRNO =
CHILD_ERROR = 256
******************************************
Can't exec "/foo/bar/paco": No such file or directory at sudotest.pl l
+ine 8.
$ /foo/bar/paco
ERRNO = No such file or directory
CHILD_ERROR = -1
Use of uninitialized value in print at sudotest.pl line 12.
******************************************
$ ls -laF
ERRNO = Illegal seek
CHILD_ERROR = 0
total 138
drwxrwxrwx 5 ignatz paco 1024 Jan 16 15:16 ./
drwxr-xr-x 21 ignatz paco 1536 Jan 16 15:34 ../
drwxrwxrwx 2 ignatz paco 512 Dec 18 15:30 CVS/
-rw-r--r-- 1 ignatz paco 298 Jan 16 14:44 sudotest.pl
******************************************
I should have included this in the first place.
()-()
\"/
`
-
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.
|