This is actually the first ever program I wrote in Perl, so I *know* there's got to be a better way to do it, since it seems that there's always a better way than the first way I did everything :)... but adapting it from your code snippets, if your call is:
<a href=/cgi-bin/test.pl?hello=2&hai=3>TEST</a>
and you want test.pl to put the 'hello' in $test1 and 'hai' in $test2, then the following code in test.pl *should* get close to what you're after:
$params = $ARGV[0];
($test1, $test2) = split('&', $ARGV[0]);
Although, technically, that will assign 'hello=2' to $test1 and 'hai=3' to $test2... but you should be able to split those off pretty easily
I haven't tested it with an ampersand, but I know that it worked in my early app, which used the colon ':' as a separator...
Trek
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.