On 1/17/2004 3:16 PM, Dan Anderson wrote:

On Sat, 2004-01-17 at 15:12, James Edward Gray II wrote:

On Jan 17, 2004, at 2:02 PM, Dan Anderson wrote:


On Fri, 2004-01-16 at 11:03, Jack Chen wrote:

Hi,

I don't know how to work with this data structure:

my @array = ((a         =>   'appple'),
            (b          =>   'tree'),
             (c         =>   'chair'));

That "array" is an array of hashes.

It was probably meant to be, but it is not as written. Look again.


Ahhh, you're right.  Correct me if I'm wrong, but the arrays expand out,
so although (a -> 'apple') is a hash and (b => 'tree') is a hash, it
actually contains the hash:

(
  a => 'apple',
  b => 'tree',
  c => 'chair',
)

Correct?

Yes. One thing that may help is to remember that => is just a fancy comma and the parentheses are only for grouping-They don't create any structure or change the type of the thing they're grouping.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to