<div dir="ltr"><div>Dear Todor,<br><br>The &#39;=&gt;&#39; operator (fat comma) IS a comma in perl.  It operates just a like a comma except that if the left side is a bare word, it is treated as a string. So (a =&gt; &#39;b&#39;) is the same as (&#39;a&#39; , &#39;b&#39;).  It&#39;s really just to help us humans see the relationship between items. <br><br>@var = (dayofweek =&gt; &#39;tuesday&#39;, month =&gt; &#39;june&#39;, day =&gt; &#39;24&#39;)<br>is &quot;easier&quot; to read than<br>@var = (&#39;dayofweek&#39; , &#39;tuesday&#39;, &#39;month&#39;, &#39;june&#39;, &#39;day&#39;, &#39;24&#39;)<br><br>But they are both equivalent code to create an array.  The first example just makes it more clear that we are putting pairs of data into the array in a certain order.  But it&#39;s still just an array of six items in a certain order.<br><br>(<a href="http://perldoc.perl.org/perlop.html#Comma-Operator" target="_blank">http://perldoc.perl.org/perlop.html#Comma-Operator</a>)<br><br></div><div>So all the ldap code all looks perfectly normal to me.  You could replace all the fat commas with commas if that makes more sense.  But the code is the same.<br><br>$var = [&#39;string1&#39; =&gt; &#39;value&#39;];&quot; is not a syntax error because you are assigning a scalar variable to an array created with brackets, so perl creates the array and then creates the scalar variable as a reference to it. You could also write &quot;$var = [&#39;string1&#39; , &#39;value&#39;];&quot; and do the exact same thing.</div><div><br></div><div>HTH  I&#39;m not sure I understand what part of the LDAP code doesn&#39;t make sense to you so if this isn&#39;t clear let me know exactly what it is that doesn&#39;t make sense to you.<br><br></div><div>Jeff<br><br></div><div>PS - this is all for perl5.  Perl6 makes changes to all this.<br></div><div><br>On Tue, May 24, 2016 at 12:50 PM, Todor Fassl &lt;<a href="mailto:fassl.tod@gmail.com" target="_blank">fassl.tod@gmail.com</a>&gt; wrote:<br>&gt;<br>&gt; Quoting from the documentation for the Net::LDAP module at<br>&gt; <a href="http://search.cpan.org/~marschap/perl-ldap/lib/Net/LDAP.pod" target="_blank">http://search.cpan.org/~marschap/perl-ldap/lib/Net/LDAP.pod</a><br>&gt;<br>&gt;  $result = $ldap-&gt;add( &#39;cn=Barbara Jensen, o=University of Michigan, c=US&#39;,<br>&gt;                        attrs =&gt; [<br>&gt;                          &#39;cn&#39;   =&gt; [&#39;Barbara Jensen&#39;, &#39;Barbs Jensen&#39;],<br>&gt;                          &#39;sn&#39;   =&gt; &#39;Jensen&#39;,<br>&gt;                          &#39;mail&#39; =&gt; &#39;<a href="mailto:b.jensen@umich.edu" target="_blank">b.jensen@umich.edu</a>&#39;,<br>&gt;                          &#39;objectclass&#39; =&gt; [&#39;top&#39;, &#39;person&#39;,<br>&gt;                                            &#39;organizationalPerson&#39;,<br>&gt;                                            &#39;inetOrgPerson&#39; ],<br>&gt;                        ]<br>&gt;                      );<br>&gt;<br>&gt;<br>&gt; Note that the second parameter is a hash reference. However, the attrs element is set to an array reference with string keys.  Not a hash ref, mind you, a normal array ref. I found tons of sample code out there with the same syntax.<br>&gt;<br>&gt; I also wrote a test program.<br>&gt;<br>&gt; #!/usr/bin/perl<br>&gt; use Data::Dumper;<br>&gt; $junk = [&#39;apple&#39; =&gt; 1, &#39;banana&#39; =&gt; 6, &#39;cherry&#39; =&gt; 99];<br>&gt; print &quot;TYPE=&quot; . ref($junk) . &quot;\n&quot; . Dumper ($junk);<br>&gt;<br>&gt; That code gives the following output:<br>&gt;<br>&gt; TYPE=ARRAY<br>&gt; $VAR1 = [<br>&gt;           &#39;apple&#39;,<br>&gt;           1,<br>&gt;           &#39;banana&#39;,<br>&gt;           6,<br>&gt;           &#39;cherry&#39;,<br>&gt;           99<br>&gt;         ];<br>&gt;<br>&gt;<br>&gt; So the arrows (=&gt;) are treated like commas. It does not create a hash ref. I would think the Net::LDAP documentation is just wrong except that I&#39;ve seen dozens of other pages with sample code that says the same thing.<br>&gt;<br>&gt; PS: IMO, &quot;$var = [&#39;string1&#39; =&gt; &#39;value&#39;];&quot; should be a syntax error.<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt;<br>&gt;<br>&gt; Todd<br>&gt; _______________________________________________<br>&gt; Ale mailing list<br>&gt; <a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>&gt; <a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>&gt; See JOBS, ANNOUNCE and SCHOOLS lists at<br>&gt; <a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br><br></div></div>