Name value pairs
The name/value pairs are the values of the FORM
fields, and their associated names for identification.
The name/value pairs are encoded as:
name=value&name=value&name=value . . .
The ampersand character (&
) separates one name/value pair from another,
so you can separate them easily with Perl's split function like this:
@pairs = split(/&/, $query_string)
Likewise, the equal sign (=
) is used to separate the name from the value within each pair. So you can separate the name from the value like this:
($name, $value) = split(/=/, $pair)
This allows you to use this sort of construct in Perl to extract the name/value pairs from the query string:
foreach $pair (split(/&/, $query_string)) {
($_qsname, $_qsvalue) = split(/=/, $pair);
. . .
}