in reply to Plural variable naming (or not?)

I support $singular and @plurals as a general convention. However, for hashes, I tend to think of hashes as providing a mapping function between a key and its value, so I frequently name it as a f() style, as in %last_name_for or %last_name_of or %has_subentries. That makes it clear to the reader that I'm holding a mapping in that hash.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: Plural variable naming (or not?)

Replies are listed 'Best First'.
Re^2: Plural variable naming (or not?)
by Jeffrey Kegler (Hermit) on Jan 26, 2016 at 21:57 UTC
    For the $singular and @plurals, I had independently come to Randal's style. I haven't used his style for hashes, but it looks good and I am going to try it.
      Only a mere 14 years later!

      -- Randal L. Schwartz, Perl hacker

      The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

        Nice to see you! :P