in reply to Howto load list context into hash of hashes?

Two minor notes unrelated to the solution already posted.

1) In Perl, for is the same as foreach - no need to type extra characters unless you're used to PHP and just prefer foreach.

2) I'm assuming REPO_BRANCHES is hard-coded value, but since you didn't put it in quotes, there's no way to tell if it's hard-coded or a declared constant. If the former, you should probably put it in quotes.

  • Comment on Re: Howto load list context into hash of hashes?

Replies are listed 'Best First'.
Re^2: Howto load list context into hash of hashes?
by NetWallah (Canon) on Nov 23, 2011 at 23:27 UTC
    Responding to your second point:
    "REPO_BRANCHES" is NOT a hard-coded value. It is a "simple identifier", and would normally be quoted.

    However (see perldata), inside curlies, perl will auto-quote it, so you do not need to. Most programmers do not use quotes when accessing hash values, because it is not necessary and adds keystrokes without adding value.

                "XML is like violence: if it doesn't solve your problem, use more."

      By "hard-coded" I mean a manually-entered value as opposed to a variable. What you probably mean by "simple identifier". And yes, Perl will auto-quote it, but my point is that in this particular context it can be ambiguous to someone reading the code, so in my opinion it's not good practice to leave the quotes out. We can agree to disagree on that one.