D
Daniel Friedman
I'm trying to figure out how to to detect non-existent hash entries
via a function, something of this general nature:
function hashexists($$) {
# first arg might have to be non-scalar to get this to work,
# that would be OK, too
my var1 = $_[0]; # maybe a scalar, maybe not
my $err_hint = $_[1];
if (exists <something here related to var1>) {
# If I can get this function to work, maybe I'll redefine
# it to provide the value of the specified hash,
# or die otherwise; for now, let's just...
return(1);
} else {
die "<something [else?] related to var1> doesn't exist; (hint:
$err_hint)"
return(0);
}
I haven't been able to do this sort of thing
with "use strict", which I regard as a must;
Any thoughts on how to achieve this?
Thanks very much,
--daniel
via a function, something of this general nature:
function hashexists($$) {
# first arg might have to be non-scalar to get this to work,
# that would be OK, too
my var1 = $_[0]; # maybe a scalar, maybe not
my $err_hint = $_[1];
if (exists <something here related to var1>) {
# If I can get this function to work, maybe I'll redefine
# it to provide the value of the specified hash,
# or die otherwise; for now, let's just...
return(1);
} else {
die "<something [else?] related to var1> doesn't exist; (hint:
$err_hint)"
return(0);
}
I haven't been able to do this sort of thing
with "use strict", which I regard as a must;
Any thoughts on how to achieve this?
Thanks very much,
--daniel