Several points.

  1. Perl references are not c pointers.

  2. What is RecursiveFunctionToDeleteValueWithinHash() (whew!) supposed to return? If it is a recursive functions to delete a value within the hash, why does it need to return a *value* at all? That is, shouldn't it just return success or failure?

  3. What do you want this code to do?
    %{$HashData} = undef; %{$HashData} = %{$value};
    You are deleting the data refered to by $HashData (and in an unidiomatic way: better to say %$HashData = () if you really want that -- but you don't), and are then populating it with a copy of whatever was (refered to) in $value. Why? If $value has the correct data, why doesn't DeleteValueTreeWithinHash() simply return it? Oh, you want an IN/OUT function? Fine, then why doesn't RecursiveFunctionToDeleteValueWithinHash() really do what it name claims and modify the data referenced by its argument?

  4. Is there a reason why you are using $_[0] and $_[1]? They *can* be used for a tricky way to get in/out function parameters, but that's not always a good idea, and when you're dealing with references anyway, there's hardly any need, anyway. Modify the referenced data; your called will see the changes.

Do yourself a favor and read perlref (or perlreftut) carefully.


In reply to Re: Problems With Hash Pointer Assignments by gaal
in thread Problems With Hash Pointer Assignments by EchoAngel

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.