Strong typing loses most of its meaning when most everything is automatically coerced into a new type...
#!/usr/bin/perl -w use strict; #try to catch as many type errors as possible #setup a few initial things $\="\n"; my $a=4; my $ref_a=\$a; my @b=("b",5); my $ref_b=\@b; my %c=("c",6); my $ref_c=\%c; print $a+@b; #coerce array into number print $a+$ref_b; #coerce reference into number my $d=eval %c; #coerce hash into string print "d=$d"; #amusing result my @e=%c;print "@e"; #hashes and arrays are different types. Oh wait +... print "c=$_" for %c; my @t=12; #coerce number into array print @t; print 0+@t; print "\\4 = ".(\4->{"what???"}); #??? sub test{ return ("a",123) }; #sub returns a list my $scalar_list=test(); #coerce into scalar my @array_list=test(); #coerce into array my %hash_list=test(); #coerce into hash print "\$scalar_list=$scalar_list\n\@array_list=@array_list"; no warnings; my %i=$ref_a; print %i; #apparently hashes can be scalar refs... no strict; $$ref_a->[88]=7; print $$ref_a->[88]


-- All code is 100% tested and functional unless otherwise noted.

In reply to strong typing by sleepingsquirrel
in thread (Completely OT) - Hero(i)n programming language on Slashdot by dragonchild

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.