Mr. Schwartz:

What an honor. It was partly reading your book a couple of years ago, which got me this far. Not that you are to blame, mind you.

Its true, I think I've gotten this to work both with and without the double quotes.

'db' will never be a key, although db_host_name, db_database, db_user and db_pw are defined.

But $config{$key} is merely my work-around. My goal here is to consolidate and better organize my config hash so I can pass shorter argument lists to my subroutines. My subroutine calls have been getting quite unwieldy as this app has grown from its first deployed working version (at a few hundred lines) to its now comparatively more complex (but more feature-full) several thousand lines.

And it is that transition which is throwing up these errors. What does it mean to "use string . . . as a HASH ref". I thought hash keys had to be scalars (i.e. strings). And I thought I had to specifically pass a hash reference (i.e. \%config) and then dereference it on the other side ($$config{db}{$key}) to have to face _references_. So I'm quite confused as to what to do about this. Perhaps I fell asleep on the chapter which explained this all to me. I don't know. Any insight appreciated.

-- Hugh


In reply to Re^2: more fun w/ HASh ref's by hesco
in thread more fun w/ HASh ref's by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.