Another great example of why it's important to actually paste the actual error message when asking a question.

Your error message was (when I pasted your code into my boilerplate)

Global symbol "$lparname" requires explicit package name at 1134744.pl + line 21. Execution of 1134744.pl aborted due to compilation errors.

When it tells you that, it means you are using a variable that hasn't been declared. To you that doesn't make sense because you can't see the one-character typo no matter how long you stare at your screen. (If it sounds like I am speaking from experience, it is because I am speaking from experience.)

So you say to yourself "Self, I know I declared my $lparname, dammit! I'm off to PM to ask for help (without pasting the error message) ..."

NO!! Don't do it!

Instead, say to yourself, "Self, I know I declared my $lparname, dammit! But if Perl says I didn't, I guess the first thing to do is have look at the statement where I declared it." And then when you get there, you know there's going to be a typo, because Perl just told you, so you can see it!

HTH :-)

The way forward always starts with a minimal test.

In reply to On the importance of reading and pasting error messages by 1nickt
in thread CGI/JSON and explicit package names. by flynn7312

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.