[Chicago-talk] Deprecated use of hash as a reference

Brad Doty bdoty at eqtc.com
Thu Apr 8 09:21:27 PDT 2010


Imran & Lee,

Well, that's the obvious choice, isn't it?

BTW, I still think it is STUPID that Perl hides all the %'s and @'s in
almost every practical use of a hash and array.  I understand why it's
$array[0], but I DON'T like it!  If it's an array, it should use the
array symbol!

I should have said that when I was sitting next to Larry Wall waiting
for a lunch that would never arrive at YAPC 2006, but the linguistic
discussion was more interesting.

So I like Imran's, but Lee's is the one which might work.

push @{%hash{$odate}}, {id => $id, ..
push @{ $hash{$odate} }, {id => $id, ...

Two issues:  We generally use the ->{key} syntax here so that
multi-level arrays and hashes are easier to express.
hash->{dim0}->{dim1}->{dim2}, etc.

And more importantly when I tried that, I used the %, not the $.  Must
have been confused.  All hell broke loose.  Not only did I get errors
for %hash, but my other variables, which were defined immediately above,
were flagged with (undeclared) Global symbols ... errors. I went down a
different path before replacing % with $.

Now that I try Lee's solution.  It compiles without error or warning.
Thanks, Lee!

BTW, I guess I'm too honest and too academic.  Now I feel that
embarrassment I was trying to avoid.
 
-  
Thanks,

Brad


-----Original Message-----
From: chicago-talk-request at pm.org
Reply-to: chicago-talk at pm.org
To: chicago-talk at pm.org
Subject: Chicago-talk Digest, Vol 81, Issue 6
Date: Thu, 08 Apr 2010 08:52:05 -0700


Lee Aylward



More information about the Chicago-talk mailing list