Hi David, Hehe... Thanks in advice. Anyway what I am looking for is making those stuff back to what they looks like when they come, that is, the $input in your script...
However, may I have some questions about your sample ? =) > my @variables = split(/[\&\;]/, $input); ; has no problem, why you would like to escape( \ )it ? > next if ($variable !~ /\=/); = also no problem , why you would like to escape it too ? Besides, if you 'next' it if that $variable is not a name=value pair, so is that mean this var will throw away ? > $name =~ tr/+/ /; > $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; Hmmm... what is this purpose ? $name is probrably going to be a var's name, how come it goes with a blank ? and with an assumption that the $name is coming as a URI escaped string ? > ...... Keep in mind, you may have multiple > # values for the same name. Just hard to imagine how come a request coming with same name. Aren't we supposing the later come value with same name will overwrite the first one ? Maybe I am still new to Perl... so I'm try to write my script to handle a form request like this ? Would you and the list comment on me ? ( except telling me to use CGI, because I won't use it unless I have to deal with multipart form =)) my %data = undef; my $input = undef; ($ENV{REQUEST_METHOD} eq "POST") ? { read (STDIN, $input, $ENV{CONTENT_LENGTH)} : { $input = $ENV{QUERY_STRING}} ; my @vars = split (/\&/, $input); for (@vars) { my ($name, $value) = split (/=/, $_); $value=~ tr/+/ /; $value=~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $data{$name} = $value; } Rgds, Connie > -------------------------------------------------------------------------- -- > my @variables = split(/[\&\;]/, $input); > foreach $variable (@variables) { > next if ($variable !~ /\=/); > > my ($name, $value) = split(/\=/, $variable); > > $name =~ tr/+/ /; > $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > $value =~ tr/+/ /; > $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; > > # assignment to some form of a variable structure that you will be > # using out side this loop. Keep in mind, you may have multiple > # values for the same name. > } > -------------------------------------------------------------------------- -- > > Regards, > David > > > > ----- Original Message ----- > From: "Connie Chan" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Wednesday, July 10, 2002 4:21 PM > Subject: What is this string type? How to play with? > > > Hi all, > > With get method from form, we always see that the > $ENV{QUERY_STRING} like this : > &message=%20%2F%15+...&....... > > btw, what is the name of that string in types of ? Escape ? Unicode ? > > With simple tr/// and s///, I can get back what exact the input > is, but, how can I make a the input back to the.... above format ? > Totally have no idea... > > Rgds, > Connie > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]