in reply to subroutine reference questions
Have a look at ref. It'll tell you what kind of reference the argument is, or return an empty string if it's a scalar. For example:
my $hashref = {}; my $arrayref = []; my $coderef = sub {}; my $scalar = ''; print "[", ref, "]\n" for $hashref, $arrayref, $coderef, $scalar;
Outputs
[HASH] [ARRAY] [CODE] []
|
|---|