<?xml version="1.0" encoding="windows-1252"?>
<node id="476400" title="Re: the basic datatypes, three" created="2005-07-20 03:50:25" updated="2005-08-11 22:57:42">
<type id="11">
note</type>
<author id="162208">
systems</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;
To find the size of an array you can you can do scalar(@a) which would return 3 originally and 4 after $a&amp;#91;4&amp;#93 was set to 4; &lt;/i&gt;
&lt;/blockquote&gt;

I think you meant $a&amp;#91;3&amp;#93; and not $a&amp;#91;4&amp;#93;   :)&lt;br&gt;
I would also like to point at this node [id://395711], I think most Perl newcomers need to be introduces as soon as possible to those context issues,e.g. &lt;br&gt;
&lt;br&gt;
&lt;i&gt;What would happen if you assign a list value to a scalar variable?&lt;/i&gt; 
&lt;br&gt;
And for this  particular question the answer would be, the scalar get the size value of the list.
&lt;br&gt;
&lt;i&gt;Why?&lt;/i&gt;&lt;br&gt;
This is how Perl works, it's a ... rule.
&lt;br&gt;
&lt;br&gt;
I am commenting on this mainly to point out that it's not obvious why would &lt;b&gt;scalar (@list)&lt;/b&gt; return the list size, one would expect a function like &lt;b&gt;size @list&lt;/b&gt;. So it would be reasonable to justify and explain those issues sooner rather than later.
&lt;br&gt;
Most people like to learn why (the justification) things works in the way they do. Not just how (the rules).
&lt;br&gt;</field>
<field name="root_node">
861</field>
<field name="parent_node">
861</field>
</data>
</node>
