<?xml version="1.0" encoding="windows-1252"?>
<node id="24173" title="RE: RE: Things are not what they seem like." created="2000-07-24 20:22:31" updated="2005-08-12 08:45:36">
<type id="11">
note</type>
<author id="2675">
btrott</author>
<data>
<field name="doctext">
Okay, here's how it works.&lt;p&gt;

Let's first clean it up (which takes all the fun out of
it, but still...):

&lt;code&gt;
    $; = $";
    $;{Just=&gt;another=&gt;Perl=&gt;Hacker=&gt;} = $/;
    print %;
&lt;/code&gt;

Looks more understandable, now, right?&lt;p&gt;

The first line sets the value of the special variable $;
to the value of $". $" is the list separator and has the
default value of a space. $; is the subscript separator,
which is used (or used to be used) for multidimensional
array emulation. As explained in [perlvar]. So saying

&lt;code&gt;
    $foo{$a, $b, $c}
&lt;/code&gt;

really means

&lt;code&gt;
    $foo{ join $;, $a, $b, $c }
&lt;/code&gt;

Since we've set $; equal to the value of $", the subscript
separator is now a space (' ').&lt;p&gt;

Next line, then:

&lt;code&gt;
    $;{Just=&gt;another=&gt;Perl=&gt;Hacker=&gt;} = $/;
&lt;/code&gt;

Let's fix it up a bit:

&lt;code&gt;
    $;{Just,another,Perl,Hacker,} = $/;
&lt;/code&gt;

That actually isn't legal, though, because the special
=&amp;gt; makes it okay to use the barewords. If we replace
them with commas, we'll get errors. And that's why we
need the =&gt; after "Hacker"; if we take it off, we get
an error.&lt;p&gt;

Anway, though, now it makes more sense, doesn't it? Because it looks
like the example above, the example from [perlvar]. We're
just assigning to a hash element in the hash %;.&lt;p&gt;

And $/ is the input record separator, the default of which
is a carriage return ("\n"). So we assign that value to
the hash element, so what we really have is something like
this:

&lt;code&gt;
    $;{ join ' ', "Just", "another", "Perl", "Hacker", "" }
        = "\n";
&lt;/code&gt;

Which is just this:

&lt;code&gt;
    $;{"Just another Perl Hacker"} = "\n";
&lt;/code&gt;

And then we're at the last line:

&lt;code&gt;
    print %;
&lt;/code&gt;

Which is very simple. We're just printing out the hash
%;, which we just assigned to. In list context, the hash
is flattened to a list. This list, in fact:

&lt;code&gt;
    ("Just another Perl Hacker", "\n")
&lt;/code&gt;

And what happens when we print out that list? Just what
you'd expect:

&lt;code&gt;
    Just another Perl Hacker
&lt;/code&gt;

So that's it. Doesn't it make you love Perl? :)</field>
<field name="root_node">
22319</field>
<field name="parent_node">
24167</field>
</data>
</node>
