in reply to Re: Return from a subroutine generates a negative value
in thread Return from a subroutine generates a negative value

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

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

Replies are listed 'Best First'.
Re: Re: Re: Return from a subroutine generates a negative value
by bobn (Chaplain) on Aug 08, 2003 at 02:14 UTC

    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