Help with complex data structures (please) 
Author Message
 Help with complex data structures (please)

A couple of requests for Netiquette:
1) Please don't post to Usenet in HTML. Not everyone can read it.
2) Please place your comments *after* what you are responding to,
   so as to follow the normal order of human discourse.

Also, comp.lang.perl is a 'dead' group. You should take your questions
to one of the other forums -- comp.lang.perl.misc for general questions.
[Message crossposted with follow-ups directed there.]

And now back to your regularly scheduled posting:

Quote:

> A list can only contain scalar values. A reference is a scalar but a
> hash is not.

Yes, but he's putting a value into a hash -- he doesn't have a list.

Quote:
> When you use syntax such as ( Attributes => %ClassAttributes ) the
> %ClassAttributes hash will be evaluated in a list context and will
> be replaced by a list of its key value pairs.

Bzzt. Sorry, but no. Hash values are scalars, so when you do something
like (A => %B) the %B will be evaluated in a *scalar* context, not as a
list. For hashes, this seems pretty bizzare, and indeed gives you
odd-seeming results: something that looks like '5/8' This value is
actually the number of buckets used/allocated for your hash. (e.g. 5 of
8) The behavior, however odd, is well defined and documented in
perldata.

Quote:
> If you use (Attributes => \%ClassAttributes) the \%ClassAttributes
> reference will be evaluated as a scalar.

Well, yes, because references are scalars. Right answer, just didn't
take the right path there. ;)

-mjc



Thu, 12 Sep 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Help with complex data structures (please)

2. [Fwd: Help with complex data structures (please)]

3. help with large, complex data structure

4. help with embedded Perl - accessing complex data structure

5. Help with complex data structures.

6. Complex data structures - HELP!

7. Need help storing a complex data structure

8. cooking complex data structures

9. Merge complex data structures

10. Sorting w/perl5 complex data structures

11. Complex (for me) Data Structure

12. searching in complex data structures

 

 
Powered by phpBB® Forum Software