I'm not quite sure what you think the uncommenting of
use strict is going to show. It's certainly not
going to forbid the use of symbolic references! Because
that's something that happens at run time, and the code
above doesn't compile when turning on strict. You can fix
this by using $::ref, $::aaa, etc.
Then you will a "useful" message about using scalar references
when turning on strict.
However, the example doesn't impress me at all. Without strict, there's nothing dangerous or even strange happening.
In fact, Perl is quite doing what people would expect.
You'd have to come up with a better example if you want
people to get hooked to use strict - this example
will just get them hooked to using symbolic references.
Abigail
-
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.
|