Hi,
I want to write a function to manipulate the variable that's passed into it, but if it's an array or hash i want to do the change to each member. is there an easy way to tell what type a variable is in Perl without making it a reference ?
example function:
sub manipulate($) {
my $var = shift;
if ($var is an array) {
foreach my $v (@var) {
...
}
}
elsif ($var is a hash) {
...
}
return $var;
}
Start Free Trial