Is there any function available in perl to check the reference type.
my $ref=\@array;
Here I need to get the reference type as array by the function.
Is there any function available in perl to check the reference type.
my $ref=\@array;
Here I need to get the reference type as array by the function.
Use function ref:
$ref_type = ref $ref;
The return value is the one of: SCALAR, ARRAY, HASH, CODE (reference to subprogram), GLOB (reference to typeglob) and REF (reference to reference).
Actually, ref function may return more values and in case of reference to object returns package name instead of type: http://perldoc.perl.org/functions/ref.html.