in reply to splitting question

Read the above, but as far as your example code, don't forget your 'g' at the end of your regexp so that you replace more than one "plus"...

$var =~ s/\+/ /g;
Even better, just use the 'tr' function:
$var =~ tr/+/ /;
For the record, the pluses should be escaped by the browser into "%2B", and you should not have to worry about the user's pluses.

Replies are listed 'Best First'.
RE: RE: splitting question
by BBQ (Curate) on May 22, 2000 at 07:47 UTC
    Or instead of subs on each one of the special values (like %20, or %2B), you can try this:
    s/%(..)/pack("C", hex($1))/eg;
    Actually, forget the above and go with CGI.pm. Its much easier...
      It was spoken:
       Or instead of subs on each one of the special values (like %20, or %2B), you can try this:
      s/%(..)/pack("C", hex($1))/eg;
      Actually, forget the above and go with CGI.pm. Its much easier...
      Arrrgh! Please, any code that uses pack there was written in the Perl4 days, before we had chr in Perl5. Are you PurlGurl? :)

      And of course, the proper thing is yes, use CGI.pm, please.

        purl, honk :o)

        Awww gee merlyn, but pack is so warm and fuzzy! seriously though, I used to use pack in the pre-CGI.pm era. When all was fire, and the great reptiles roamed the earth. That's why I remebered pack! Do you remember this?