Home arrow Perl Programming arrow Parsing a Querystring With Perl

Parsing a Querystring With Perl

Having trouble parsing a querystring with Perl? If so, then Jeff's step-by-step guide will save you headaches and have you up and running in no time!

  1. Parsing a Querystring With Perl
  2. A Simple ISINDEX Query
  3. A Simple POST Query
By: Jeff Pinyan
Rating: starstarstarstarstar / 7
December 18, 2002

print this article


At first, parsing a CGI query sounds like a simple task. A query is just a list of key-value pairs, so a hash sounds like the right tool. But many CGI query parsers fail for anything other than what the specific query is they expect. What if it's a POST when you expected GET? What if the pairs are delimited by ; instead of &? What if the query is encoded via m/fd instead of a/xwfu? What if there's more than one value for a field? And what about file uploads, a topic I've not covered yet?

How quickly a simple function becomes complex. But if we break the cases down into simple procedures, we'll see it's not as bad as we thought.

>>> More Perl Programming Articles          >>> More By Jeff Pinyan

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates


Dev Shed Tutorial Topics: