As
moritz said, this is actually a shell command.
eval is both a shell and a Perl command, but in this case it is the shell version.
In most UNIX shells (not csh), $? is the status of the previous command (in Perl it is the exit status of the previous child process - not the same thing). In a shell, parentheses create a
sub-shell which is a new shell environment (I use the term loosly) in the same process, so
eval '(exit $?0)' in
shell exits the sub-shell (not the current process). In shells, an evaluation of non-zero is considered false, and 0 is considered true (consider 0 to be 'success').
exec also is in both shells and Perl, and it replaces the current program with a new one in the same process, so it will replace the shell with perl.
In this case, the
if 0 will be considered part of the command by a shell. However, in Perl the
if 0 has precedence, so none of that will be executed if we are running perl, zero being false in perl (and most languages). Try:
print "A " && print "B " && print "C " if 0;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.