http://www.perlmonks.org?node_id=189921


in reply to Re: •Re: Interesting CGI.pm query_string behavior
in thread Interesting CGI.pm query_string behavior

Indeed. It even becomes clearer when we look at the CGI.pm code. :)

#### Method: query_string # Synthesize a query string from our current # parameters #### 'query_string' => <<'END_OF_FUNC', sub query_string { my($self) = self_or_default(@_); my($param,$value,@pairs); foreach $param ($self->param) { my($eparam) = escape($param); foreach $value ($self->param($param)) { $value = escape($value); push(@pairs,"$eparam=$value"); } } return join($USE_PARAM_SEMICOLONS ? ';' : '&',@pairs); }

- from CGI.pm

So it simply constructs a query string from the given name/value pairs already in the CGI object. It'll even use that far-out semicolon format if you want it to. :)