I can see a couple more issues.

One is that, when (as I mentioned) you use strict; and use warnings;, you get:

Global symbol "$userid" requires explicit package name at x line 17. Global symbol "$password" requires explicit package name at x line 18. Global symbol "$projectid" requires explicit package name at x line 19 +. Global symbol "$ordertypeid" requires explicit package name at x line +20. Global symbol "$orderdateid" requires explicit package name at x line +21. Global symbol "$accountid" requires explicit package name at x line 22 +. Global symbol "$segcodeid" requires explicit package name at x line 23 +. Global symbol "$marketid" requires explicit package name at x line 24. Global symbol "$marketday" requires explicit package name at x line 25 +. Global symbol "$marketmonth" requires explicit package name at x line +26. Global symbol "$marketyear" requires explicit package name at x line 2 +7. Global symbol "$putcall" requires explicit package name at x line 28. Global symbol "$strikeprice" requires explicit package name at x line +29. Global symbol "$bs" requires explicit package name at x line 30. Global symbol "$quantity" requires explicit package name at x line 31. Global symbol "$orderprice" requires explicit package name at x line 3 +2. Global symbol "$entered_by" requires explicit package name at x line 3 +4. Global symbol "$resultid" requires explicit package name at x line 80. Global symbol "$resultdesc" requires explicit package name at x line 8 +1. Global symbol "$orderid" requires explicit package name at x line 82.

Of these, note that $resultid is defined within the if clause:

if ($response->{channel}->{error}->{errorid} == "") { # ... my $resultid = $response->{channel}->{result}->{resultid};\ # ... };

... so of *course* it's not going to be available outside of the block.

You're also trying to return from outside of a subroutine, as well as comparing a string using "==" in the if statement I referenced above (you should really either use eq for string comparisons, or change "" to the numeric 0).

Is this the whole code sample, or just part of it?

And what happens when [id://jugdish114|you] add use strict; and use warnings; to it?


s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

In reply to Re: how to assign hash element value to scalar? by liverpole
in thread how to assign hash element value to scalar? by jugdish114

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.