LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   type of list element in Perl ? (http://www.linuxquestions.org/questions/programming-9/type-of-list-element-in-perl-456540/)

thelonius 06-20-2006 08:35 AM

type of list element in Perl ?
 
Hello,

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 08:45 AM

try "ref( $reference )".

thelonius 06-20-2006 08:49 AM

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


THANKS!!!!!!!

Perl is really great...


Quote:

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



All times are GMT -5. The time now is 01:12 PM.