6499N/A========================== Create file /var/tmp/a.pl ===========================
6499N/Ause strict;
6499N/Ause warnings;
6499N/A
6499N/Ause CGI;
6499N/A
6499N/Amy $q = CGI->new;
6499N/A
6499N/A# Process an HTTP request
6499N/Amy @values = $q->multi_param('form_field');
6499N/Amy $value = $q->param('param_name');
6499N/A
6499N/Amy $fh = $q->upload('file_field');
6499N/A
6499N/Amy $riddle = $q->cookie('riddle_name');
6499N/Amy %answers = $q->cookie('answers');
6499N/A
6499N/A# Prepare various HTTP responses
6499N/Aprint $q->header();
6499N/Aprint $q->header('application/json');
6499N/A
6499N/Amy $cookie1 = $q->cookie(
6499N/A -name => 'riddle_name',
6499N/A -value => "The Sphynx's Question"
6499N/A);
6499N/A
6499N/Amy $cookie2 = $q->cookie(
6499N/A -name => 'answers',
6499N/A -value => \%answers
6499N/A);
6499N/A
6499N/Aprint $q->header(
6499N/A -type => 'image/gif',
6499N/A -expires => '+3d',
6499N/A -cookie => [ $cookie1,$cookie2 ]
6499N/A);
6499N/A================================================================================
6499N/A
6499N/A$ perl /var/tmp/a.pl
6499N/AContent-Type: text/html; charset=ISO-8859-1
6499N/A
6499N/AContent-Type: application/json; charset=ISO-8859-1
6499N/A
6499N/ASet-Cookie: riddle_name=The%20Sphynx%27s%20Question; path=/
6499N/ASet-Cookie: answers=; path=/
6499N/AExpires: Sat, 25 Jun 2016 10:55:24 GMT
6499N/ADate: Wed, 22 Jun 2016 10:55:24 GMT
6499N/AContent-Type: image/gif; charset=ISO-8859-1
6499N/A