perl regex assistance

From: Tim Schneider <tim_at_no.spam.please>
Date: Thu Oct 18 2007 - 14:47:59 CST

Don't write much perl anymore. Never really did in the first place. I
have a question.

I have a script that I am working with it has (use strict;) defined.
and the first line is #!/usr/bin/perl -w

I am trying to use this script to react to an html request of the form
http://server.tld/cgi-bin/move_camera?command=reset

so I use this bit of code:
# Read GET variables into %arg
for (split /\&/, $ENV{QUERY_STRING}) {
   ($key,$val) = split /=/;
    $val =~ s/+/ /g; <---- offensive
    $val =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
    $arg{$key} = $val;
}

I have to comment out the offensive line $val =~ s/+/ /g; which to me
reads as substitute any plus signs for blank spaces in the string $val

I get an error in the webserver log file:
Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE /
at /usr/local/www/cgi-bin/move_camera line 105.

My solution is to comment out line 105 and also ensure that no spaces
(URL encoded as '+') are sent in the command string to the cgi perl
script. Is there a better way?

Thanks.
Received on Thu Oct 18 14:48:08 2007

This archive was generated by hypermail 2.1.8 : Thu Oct 18 2007 - 14:48:15 CST