Re: how to define a variable to hold a multiline text input in perl from html multiline textbox

From: Paul Lalli (mritty_at_gmail.com)
Date: 11/29/04


Date: Mon, 29 Nov 2004 20:55:45 GMT


"dale zhang" <zhangd@tycoelectronics.com> wrote in message
news:60460471.0411291238.22fe6793@posting.google.com...
> Here is my script:
>
> #!/usr/bin/perl

<snip>

> sub populatePostFields {
> %postFields = ();
> read( STDIN, $tmpStr, $ENV{ "CONTENT_LENGTH" } );
> @parts = split( /\&/, $tmpStr );
> foreach $part (@parts) {
> ( $name, $value ) = split( /\=/, $part );
> $value =~ ( s/%23/\#/g );
> $value =~ ( s/%2F/\//g );
> $postFields{ "$name" } = $value;
> }
> }
>
> Any suggestions? -Dale

Yes, get rid of this entirely. Use CGI.pm;. Also use strict; and use
warnings;. Read about CGI.pm (and how much easier this code suddenly
becomes once you use it) by typing
perldoc CGI

Paul Lalli