I am trying to pass 2 file handles AND 2 hashes by reference and I think I did it correctly but I dont know how to get the values once I am in the sub "catch_error". Can someone offer guidance?
my $location_hash = get_location(\*ZIPS); my $cat_hash = get_categories (\*SICS); for my $city ( keys %$location_hash ) { printf "%s %s %s\n", $city, $location_hash->{ $city }->{ 'ST' }, $l +ocation_hash->{ $city }->{ 'ZIP' } ; for my $cat ( keys %$cat_hash) { printf "%s %s\n", $cat, $cat_hash->{ $cat }->{ 'NUM' } ; . . . catch_error(\*LOGS, \$page, \$location_hash, \$cat_hash ); # +how can I pass by ref ? # I cant seem to delete the keys that were used. So so I wi +ll set a value # delete ($location_hash->{ $city }->{ 'ST' }) ; #### Addi +ng another post about this because I cant remove the key $location_hash->{ $city }->{ 'PR' } = 1; $cat_hash->{ $cat }->{ 'PR' } = 1; } # for my $cat ( keys %$cat_hash) } # for my $city ( keys %$location_hash ) { sub catch_error{ my ($fh, $str, % ) = @_; # confused right here! ### Then I will print to the log and I will print the keys ### and values from the hashes that I did not process. ### I am having a problem deleting the key so I added a key and set + it to 1 ### I will create another posting for that question titled "How can + I delete a key from a hash". }

In reply to Function hash by reference. by kevyt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.