Re: print statement creates key in hash with reference to empty array??



>>>>> "r" == rhorizon74 <rhorizon74@xxxxxxxxx> writes:

r> The are a bunch of scenarios where a different module is supposed to
r> build a hash, and my module needs to print the values. In which case
r> for each level of nesting of a hash i will be forced to check if the
r> node exists (starting with the outer hash and going onto the inner
r> hash). With my limited exposure to perl i guess it seemed a bit
r> diffcult to grasp.

why are you printing lower levels and not the upper ones? try using
data::dumper instead of rolling your own tree dumper.

r> I did check with a lot of colleagues some who were not exactly novices
r> like me with way much more experience in perl and they too had come
r> across this scenario (they grappled with this by adding checks for each
r> level before printing the values) , but to be honest none with any
r> exact knowlege of vivication. So it did seem like this problem was
r> commonly faced by a lot of programmers.

it seems you still haven't read my article. have you? it has a sub which
will do what you want so you don't have to reinvent it. i suggest you
read it and also tell your colleagues to read it.

r> Thanks for the reply

no thanks for the top post with full quote of my email. have you read
the group guidelines which are posted regularly?

<snip of my entire quoted post>

uri

--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
.



Relevant Pages

  • Re: print statement creates key in hash with reference to empty array??
    ... The are a bunch of scenarios where a different module is supposed to ... build a hash, and my module needs to print the values. ... > r> But a print statement shouldnt really be creating any data. ... > learn more about autoviv and why it is like it is. ...
    (comp.lang.perl.misc)
  • Re: Composite Keys with pairs generic collections
    ... Conversely, if the hash functions of the individual members *don't* produce nicely distributed hash codes, what sort of algorithm would minimize the damage for the composite hash code? ... Values don't tend to be uniformly distributed - values and are likely to come up in the same map in various scenarios, as are various values. ...
    (microsoft.public.dotnet.languages.csharp)