I'm lost at the very first line of your example code where it appears you are assigning a hash to a scalar.

I feel your pain!
For a long time, this sort of syntax was alien to me. But it is worth taking time to understand.

$config = { verbosity => 3, logger => 12, };

This is assigning an anonymous hashref.
Consider this instead:

# Create a hash my %myhash = ( 'verbosity', 3, 'logger', 12 ); # Assign it to a hashref my $myhashref = \%myhash; # To get the same result # without the hash variable my $myhashref = { verbosity => 3, logger => 12, };

For many years, references were beyond me.

It is easy to just say that we don't understand them and dismiss that as the way that it will always be. This is what Carol Dweck describes as a "Closed Mindset". The alternative is to reframe the problem. Instead, say that we don't know how to do it yet but we can learn - it might be difficult, but it is possible. Then the only question is whether one is prepared to put in the effort and be humble enough to ask for help and receive wise counsel from those who provide it without getting defensive when information and methods that don't make sense are presented. Nothing makes sense until it has been learnt...that's why people used to think the Earth was flat...

I asked here in the Monastery about references. Several Monks gave conceptual models that didn't make sense and examples that I didn't understand. I tried to use references in test code and failed. I tried changes, sometimes at random, until I got something working or, at least, giving a different error message. I asked if my understanding of what was happening was right. Slowly I grew to understand...

You too can understand references, OOP and trigonometry...but it requires an open mindset...


In reply to Re^4: Ordering of parameters - Re^9: Converting Unicode by Bod
in thread Converting Unicode by BernieC

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.