in reply to Return from a subroutine generates a negative value

For clarity i would suggest not using a global %rrd and a local $rrd in the same sub. You could rename one or the other to make it clear. At first i thought you where using a hash as a key in a hash, seemed strange. :-)

___________
Eric Hodges
  • Comment on Re: Return from a subroutine generates a negative value

Replies are listed 'Best First'.
Re: Re: Return from a subroutine generates a negative value
by TomDLux (Vicar) on Aug 08, 2003 at 00:18 UTC

    I take completely the opposite view. I see it as quite natural to use the same name for a hash or array and for individual elements. Generally, I try to make the collective object be plural, while the individial are sometimes localized with 'the_rrd' or 'a_rrd', but often the sigils are sufficient differentiation, especially if the scope is small.

    --
    TTTATCGGTCGTTATATAGATGTTTGCA

      I'm in between you two (is ambivalence a problem for me? Maybe...). I'll end up using the plural and singular so I can say for my $host ( @hosts ) { code }, but I think using the exact same name could be confusing. Admittedly anyone who knows perl will know that $host and $host{key} are compeltely different variables, but why court confusion? Also, if you keep them separate, 'strict' and 'warning' can save you from typos or brainfarts.

      --Bob Niederman, http://bob-n.com