I thought Perl 5 was Strongly Typed. In what way is it Weakly Typed?
Considering only Perl's types at their highest level -- this means scalar, array, and hash -- then it is strongly typed. You cannot coerce one into the other. You can "convert" between types in some sense, as in %hash = @arr, or @arr = $scalar. But you can never use hash-specific operations on an array, or vice-versa.
On the other hand, if you consider the different kinds of scalar datatypes -- boolean, string, int, float, reference -- it is weakly typed. These types of values can all be freely coerced into each other, with the exception of coercing into a reference. You can freely perform int-specific or string-specific operations on any scalar variable.
-
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.
|