Hey all, variable question that I'm sure has been asked before in some form: how do I determine what type a variable is? I'm passing a subroutine arrays and strings, but I don't know how many strings or how many arrays, nor do I know what order they're coming in. So, I have:
I'm looking for something that does what I hoped array($var) would do above.
-Nick
Code:
sub sample {
my $var;
while($var = shift) {
if(array($var)) {
foreach my $i (@{$var}) {
print "is array:", $var[$i], "\n";
}
} else {
print $var, "\n";
}
}
}
I'm looking for something that does what I hoped array($var) would do above.
-Nick