I'm trying to check if a hash key exists and if the value is 1.  I'm passing
the reference to the hash to a subroutine like:

my $help = 1;
my %hash = (help=>\$help);
somefunc(\%hash);

sub somefunc {
    my ($refHash) = @_;

    if ((defined $refHash->{help}&& ${$refHash->{help}}) {
        # stuff
    }
    else {
        # other stuff
    }
}

This seems long an clumsy, I suspect there is a cleaner way to do it in perl
but I don't know how.  I played around with "exists" but that just tells me
that the value exists.  I need to do some processing if the value is "1" and
other processing for "0";

Thanks (as always)
Jay

Jay Strauss
[EMAIL PROTECTED]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to