[ABE.pm] data structures within data structures

Phil Lawrence phil at five-lawrences.com
Mon Jan 3 09:05:06 CST 2005


On Dec 31, 2004, at 12:49, Jim Eshleman wrote:
>
>   I don't understand the question/example, but you'll likely find what 
> you need in "perldsc", the Perl Data Structures Cookbook:
>
>   perldoc perldsc
>
> Check out the CODE EXAMPLES section.

Good answer.  I'm woefully unfamiliar with perldoc!

Ric gave some good examples, and for my $.02 I'll preach on the infix 
operator ( i.e. this arrow looking thing:  ->  )

I love the infix for it's visual cue.  So much nicer to see:
   $ds->[1][2][2]
instead of
   $ds[1][2][2]

Of course that requires $ds be an aref instead of an array, but that 
doesn't bother me.

Hmmm.  I've used the "arrow operator" for some neat visual cues...  
can't remember...

Well, in the meantime, while I'm thinking, I'll mention it is used to 
dereference coderefs:
   $cr->( 'arg1', 'arg2' );

Oh, well.  Can;t remember whatever is nibbling at my brain.  But infix 
ops are optional, i.e.
   $ds->[1]->[2]->[2]
is the same as:
   $ds->[1][2][2]

You have some freedom of expression, for example if you wanted to make 
the last level stand out:
   $ds->[1][2]->[2]

prl 



More information about the ABE-pm mailing list