CGI

GET

use DBI;

my $query = new CGI;
my $param_value = $query->param('param_name');
  • If the parameter was not sent, the value retrieved is an empty string.

POST

use DBI;

my $query = new CGI;
my $param_value = $query->param('param_name');
  • If the parameter was not sent, the value retrieved is an empty string.

Environment variables

my $url       = $ENV{'REQUEST_URI'};

my $base_url = $ENV{'SCRIPT_NAME'};
my $url_query = $ENV{'QUERY_STRING'};

HTML forms

Text field

  • If the field is empty, the value retrieved is an empty string.

Radio button

  • If no item was selected, the value retrieved is an empty string.

Check box

  • If the field is unchecked, the value retrieved is an empty string.

Single-selection list

  • If no item was selected, the value retrieved is an empty string.

Multiple-selection list

  • The value is retrieved as an array of strings.
  • If no items were selected, the value retrieved is an empty array.

Resources URL: 
notes/perl/resources
Sources URL: 
notes/perl/sources

See Also