Skip to main content.
home | support | download

Back to List Archive

Re: help with cgi script!

From: Bill Moseley <moseley(at)>
Date: Wed Mar 15 2000 - 15:46:54 GMT
At 07:06 AM 03/15/00 -0800, GX wrote:
>hi I am having trouble with one of my cgi scripts, I need it to encode the
>url sothat 'spaces' become '%20' can anyone give any advice?
>As far as I can tell its somewhere by line#170..
>attached is a copy of the script!

s/ /%20/g;

To really answer your question:

use CGI;  # make your program bigger
my $url = CGI::escape( $link );

And a few comments:

#!/usr/bin/perl5 -wT
use strict;

Would be a really good addition.

open(SWISH, "$command|");

Besides checking the return value of open() you might consider the security
risks with this type of open.  I know you filter $array{keywords}, but you
are still passing user data through the shell.

perldoc perlsec
perldoc perlipc

Bill Moseley
Received on Wed Mar 15 10:48:45 2000