I cannot answer your question, because you have changed your post so that it no longer says what you are looking for. Moreover, any monk who reads your question after this point will have the same problem. Updating your posts with further comments and corrections is fine. Updating your post to delete the question you originally asked is not fine, so please don't do it.

Nevertheless I will guess that your question concerns why the code as you have it now does not print out "hi there" and moreover returns an error Not a HASH reference at - line 27. The reason is that the value returned by first is not a reference to the hash %objREF but rather a reference to a scalar value, containing a string, which so happens to be the third element of an array that has fallen out of scope. If you wrote your code for two as

my $objREF = shift; print $$objREF;
you would see the desired result. If you added the line
return \%objREF;
to the end of first then the line
print ${$objREF->{poker}}
would be the correct way to print it out from two.

Update: This reply refers to the modified version of the node, before the original was restored, but I am leaving it in place for safe-keeping. Thanks castaway and janitors.


In reply to Re: code sample: possible improvements by Errto
in thread code sample: possible improvements by arcnon

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.