-   Programming (
-   -   type of list element in Perl ? (

thelonius 06-20-2006 09:35 AM

type of list element in Perl ?

I wonder if it's possible to know the type of a list element, i.e. is it a scalar or a list reference or a hash reference ?

My initial problem is to implement a data structure for three kinds of "phenomena" - word, optional word and alternative word. I think to use a list containing scalars for words, references to lists for optional words and references to hashes for alternatives.

Thank you in advance.

spirit receiver 06-20-2006 09:45 AM

try "ref( $reference )".

thelonius 06-20-2006 09:49 AM

Exactly what I'm looking for (should've thought it with my head...).


Perl is really great...


Originally Posted by spirit receiver
try "ref( $reference )".

All times are GMT -5. The time now is 10:50 AM.