develooper Front page | perl.beginners | Postings from March 2002

How do I pass a hash to a sub, and get to it in the sub?

Thread Next
From:
John Crockett
Date:
March 2, 2002 08:16
Subject:
How do I pass a hash to a sub, and get to it in the sub?
Message ID:
20020302161433.65001.qmail@onion.perl.org
I'm sure this is such a simple thing, most of you-all are laughing at me
right now.

main_program
{
    blah;
    blah;

    %input_parm = ();
    $input_parm{PRICE} = "42.00";
    $input_parm{PRODUCT_ID} = "1306";
    $input_parm{INVENTORY_LOC} = "107";
    $input_parm{CUSTID} = "23489";

    my_subroutine(%input_parm);

    more irrelevant code;
    .
    .
    .
}


sub my_subroutine(%)
{
    This is where I have trouble. I can't figure out the notation for
reading the hash!
}


Thanks for your help.

John Crockett
John@TheNoSpamCrocketts.com

(Take out NoSpam to e-mail me)



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About