in reply to Detect and reset hashes

A variable can't "be a hash or a scalar," but could contain a value called a "reference;" a reference can point to just about any perl entity or data type.
my $val = func(); print "Reference to a HASH!\n" if ref($val) eq "HASH"; print "Reference to a ARRAY!\n" if ref($val) eq "ARRAY"; print "Reference to a SCALAR!\n" if ref($val) eq "SCALAR"; print "A non-reference SCALAR!\n" if not ref($val);
The above will work if the value returned isn't actually blessed into a package; if that's a possibility, then you might want to check out isa() instead.

--
[ e d @ h a l l e y . c c ]