One way would be to use
CGI to get the values out for you. (assuming the response is in $response):
use CGI;
my $q = new CGI($response);
print 'My ID = ' . $q->param('id');
print 'My Results = ' . $q->param('results');
This is probably safer than rolling your own method.
If you want to access them as a hash, you can call the Vars() method:
my %params = $q->Vars;
print "My ID = $params{'id'}";
Note the difference in syntax to your example - you have to use double quotes to print variables, and hash elements are accessed with a $ sigil and curly brakets around the key name.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.