quick perl question
-
How can I test whether a variable is a hash, array, or scalar? I've got this complicated tree structure made up of hashes arrays and scalars, and I want to recursively print out every element. ;P Why is the phrase "It's none of my business" always followed by "BUT..." ;P
-
How can I test whether a variable is a hash, array, or scalar? I've got this complicated tree structure made up of hashes arrays and scalars, and I want to recursively print out every element. ;P Why is the phrase "It's none of my business" always followed by "BUT..." ;P
In Perl the type of a variable is known at compile time (as indicated by the
$
or@
or%
prefix). Or did you mean the type of data that a reference is pointing to? In that case, use theref
function. And BTW look at theData::Dumper
module, it might already do what you want. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!" -- Rico Mariani, CLR perf guy