John <> wrote:
> (Tad McClellan) wrote in message news:<>.. .
>>
>> This is not a list (as in "email list"). This is a Usenet newsgroup.
>>
>
> My apologies, Tad, I didn't mean to denigrate this fine old pillar of
> the internet
.
I point out the distinction not because mailing lists are "bad"
or "worse".
I point out the distinction because they are different dynamics,
with different rules of what is socially acceptable.
>> > or
>> > %hashname(key => value);
>> > or
>> > %hashname("key","value");
>> > but not
>> > %hashname{$key}{$other} = value;
>>
>>
>> None of those are Perl (5).
>>
>
> What do you mean?
$ perl -e '%hashname(key => value)'
syntax error at -e line 1, near "%hashname("
Execution of -e aborted due to compilation errors.
$ perl -e '%hashname("key","value")'
syntax error at -e line 1, near "%hashname("
Execution of -e aborted due to compilation errors.
$ perl -e '%hashname{$key}{$other} = value'
syntax error at -e line 1, near "%hashname{"
Execution of -e aborted due to compilation errors.
I mean that none of them are written in the Perl programming language.
I also mean that they _will_ be part of the Perl programming
language in a few more years, when Perl 6 is released.
> The first two structures above are shown in my perl
> book
It is a crap book then. Syntax errors are inexcusable.
> which specifically refers to perl 5.005 (the book is from a
> programming class I took several years ago ... I know it's old, but
> it's still handy).
If it teaches non-Perl as Perl, then it is moving you _backwards_
in your understanding. Throw it in the trash (or sell it on E-bay).
> I seem to recall being told that the "=>" (arrow)
> sign within a hash structure was a perl v5 feature not found in
^^^^^^^^^^^^^^^^^^^^^^^
> previous versions.
The "fat comma" ( => ) has nothing to do with a hash structure,
it just happens that that is where most people choose to use it.
(and yes, it was introduced in version 5.mumble-mumble).
It is just another way of writing a comma (with a little extra
treatment for the left-hand operand).
print 'hi' , ' ' , 'there';
print 'hi' => ' ' => 'there';
print hi => ' ' => there;
all make the same output.
> O&BTW, what did you mean when you said "perl programmer" versus "Perl
> programmer"?
That Question is Asked Frequently:
What's the difference between "perl" and "Perl"?
A hash in a scalar context is only useful to the C programmers
that work on the perl binary. It is useful for evaluating the
effectiveness of perl's built-in hashing algorithm.
> Is there some kind of class warfare involving leading
> upper-case characters that I wasn't aware of?
No, there is some kind of different semantic between when
you say "perl" and when you say "Perl".
> My pound-bang
> specifically says /usr/bin/perl and not /usr/bin/Perl ...
...
Which illustrates the difference rather nicely, as it is referring
to the perl binary (the interpreter) rather than to the Perl
programming language.
> %hashname{$key}{$other} = value;
That still is not Perl. You must have meant this instead:
$hashname{$key}{$other} = 'value'; # barewords are "bad" too
^
^
> represents a 'hash of hashes' where the hash defined as
> "%hashname{$key}" dereferences to another hashname which is then
^^^^
No, it refers to another hash, whether that hash has a name or not.
The name of something is not the same as the something being named.
You can have named or anonymous hashes in Perl.
> Holy
> cr@p, batman! Now all of a sudden all kinds of funky hashes I've seen
> are starting to make sense!!!!! Whoa ... my head is spinning ...
Welcome to our (Perl) world!
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas