Try treating a hash like a scalar. Or a scalar ref like an array ref.

You can however treat a number like a string and a string like a number in many cases. And while the "public" type system my just call all these scalars, the underlying implementation makes a distinction (i think it is IV and SV types, i don't recall exactly).

And then there is of perl's idea of contexts. I can use an array like a scalar and get back its length. I can assign an array to a hash without too much trouble if the array has an even number of elements. This adds a level of flexibility (and sometimes confusion on the part of the programmer) to perl's type system which keeps me from seeing it as a truely strongly typed language. Yes, it's closer than some, but IMO its not that close. However just as TIMTOWTDI, there is more than one way to look at it too.

As I said, it is very difficult to classify a language as having a specific type system, most all will blur the lines and defy strict classification. One of the great things about perl IMO is its inability to be classified.

-stvn

In reply to Re^11: use fields; # damnit by stvn
in thread use fields; # damnit by nothingmuch

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.