Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Howto load list context into hash of hashes?

by TJPride (Pilgrim)
on Nov 23, 2011 at 11:10 UTC ( [id://939637]=note: print w/replies, xml ) Need Help??


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.

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://939637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-03-28 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found