Hello Bhushan,

  1. "Learn about strings and interpolating double quotes."
  2. Don't continue until you have completed #1.
  3. "Build your string outside the call to ->content()."
  4. Don't continue until you have completed #3.
  5. Use Data::Dumper to see what is in the variables. It may not be what you think. Like:
    use strict; use warnings; use Data::Dumper; use feature qw/ say /; my $string; # your code here to build a complex string say Dumper( $string );
  6. Don't continue until you have completed #5.

In general, it looks like you are rushing too much to try to make your scripts accomplish your ultimate goal, without learning the steps necessary to get there. I suggest that you try to learn some basics about Perl programming before trying to do relatively complex tasks like speaking JSON to a remote server. Have you worked through any Perl tutorials?

There are no shortcuts to becoming an effective programmer. You might be able to find out how to do what you want with a question on PerlMonks or Stack Exchange, but if you don't understand what it is that you are doing and why it works, you will not be able to fix it when it breaks or extend it when $boss wants a new feature.

The requirements of your ($boss, $job) might mean that you just have to get It working Now ... we've all been there. But then you have to spend many many hours practicing the basic techniques in an environment that is _not_ your live project, in order to really learn what is going on.

One effective technique is to get a script or a piece of code that works, from here or from somewhere else, then "reverse engineer" it to see how it works. Start commenting out lines and reducing the complexity of the code, all the way down so it simply compiles, with no function. Then start adding the lines back in one by one, not advancing until you understand. Reduce the data to the simplest it can be (eg just one element in an array) ... just make the simplest script you can. Gradually you can build the complexity back in.


In reply to Re: How to pass variable in the LWP module by 1nickt
in thread How to pass variable in the LWP module by bhushanQA

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.