tr/// "translates" from one character to another. So fo each "+" it finds it "translates" it to a space. The purpose of tr/// is to be able to give it one or more characters in the left part of the match and one or more characters on the right side, and it will translate each char on the left to the corrosponding char on the right.
This example should help... tr/abc/xyz/ This converts "a" to "x", "b" to "y", and "c" to "z". So "have a nice day" will be changed to "hxve x nize dxy". Hope that helps. Rob -----Original Message----- From: Ron [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 23, 2002 2:18 PM To: [EMAIL PROTECTED] Subject: RegEx question I have been using the below subroutine for Parsing my data from forms. The question I have; can someone explain this line to me, $value =~ tr/+/ /; The tr has me a bit confused. Thank you for any input, Ron ==================================================== sub Parse_Form { if ($ENV{'REQUEST_METHOD'} eq 'GET') { @pairs = split(/&/, $ENV{'QUERY_STRING'}); } elsif ($ENV{'REQUEST_METHOD'} eq 'POST') { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); } else { print "Content-type: text/html\n\n"; print "<P>Use Post or Get</P>"; } foreach $pair (@pairs) { ($key, $value) = split (/=/, $pair); $key =~ tr/+/ /; $key =~ 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; $value =~ s/<!--(.|\n)*-->//g; if ($formdata{$key}) { $formdata{$key} .= ", $value"; } else { $formdata{$key} = $value; } } } 1; -- 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]