Nothing in the code you show does anything that would give $! a meaningful value. The value $! actually has at the moment the code shown is executed was either set in some previous operation that gave $! a meaningful value (update: see this), or else it's the value $! happened to have at program startup (update: see this), i.e., random. Either way, its value is meaningless.
Update: Consider this code:
c:\@Work\Perl\monks>perl -wMstrict -le
"my $year = 987;
$! = 0;
if ($year !~ /\d{4}/) { die qq{Idiot!, use 4 digit year. Stopped '$!'
+} }
"
Idiot!, use 4 digit year. Stopped '' at -e line 1.
Now try assigning different values (1, 2, 3, ...) to $! and see what messages you get. The messages you're seeing in your posted code are just cruft.
Give a man a fish: <%-{-{-{-<
-
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.
|