<div dir="ltr"><br><br><div class="gmail_quote">On Tue, May 19, 2015 at 1:08 PM Alan Mead <<a href="mailto:amead2@alanmead.org">amead2@alanmead.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Curiosity #2: Also, I converted a program from Pascal to Perl and I<br>
forgot one assignment operator (e.g., something like my $a := 1;) and<br>
Perl never complained.  What does := do in Perl? It's hard to google<br>
ops. In a test program, it looks like it's a valid assignment operator?<br>
<br>
$ cat <a href="http://test.pl" target="_blank">test.pl</a><br>
#!/usr/bin/perl<br>
use strict;<br>
use warnings;<br>
my $a := 42;<br>
print "$a\n";<br>
$ ./<a href="http://test.pl" target="_blank">test.pl</a><br>
42<br></blockquote><div><br></div><div>To investigate, I ran it through B::Deparse and got this interesting nugget:</div><div><br></div><div>







<p class="p1"><span class="s1">perl -MO=Deparse -E 'my $x := 42; say $x'</span></p>
<p class="p1"><span class="s1">Use of := for an empty attribute list is not allowed at -e line 1.</span></p><p class="p1"><span class="s1"><br></span></p><p class="p1"><span class="s1">So what it is trying to do is apply an empty attribute list. Using attributes on variables is a very rare thing, so perhaps few people know it exists, read more here: <a href="https://metacpan.org/pod/attributes">https://metacpan.org/pod/attributes</a></span></p><p class="p1">A possibly useful example is that this fails:</p><p class="p1">







</p><p class="p1"><span class="s1">perl -E 'my $x :Int = 42.2; say $x'</span></p><p class="p1"><span class="s1">but generally, I think variable attributes are best avoided.</span></p><p class="p1"><span class="s1"><br></span></p><p class="p1"><span class="s1">Joel Berger</span></p></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
-Alan<br>
<br>
<br>
--<br>
<br>
Alan D. Mead, Ph.D.<br>
President, Talent Algorithms Inc.<br>
<br>
science + technology = better workers<br>
<br>
+815.588.3846 (Office)<br>
+267.334.4143 (Mobile)<br>
<br>
<a href="http://www.alanmead.org" target="_blank">http://www.alanmead.org</a><br>
<br>
Announcing the Journal of Computerized Adaptive Testing (JCAT), a<br>
peer-reviewed electronic journal designed to advance the science and<br>
practice of computerized adaptive testing: <a href="http://www.iacat.org/jcat" target="_blank">http://www.iacat.org/jcat</a><br>
<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org" target="_blank">Chicago-talk@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</blockquote></div></div>