in reply to Re: Problem with assignment for class...
in thread Problem with assignment for class...

Will this prevent the script from executing (i.e. more of a Warning than an Error such as with C++)? If so, what method should I use for replacing + with a space for processing POST input?
  • Comment on Re: Re: Problem with assignment for class...

Replies are listed 'Best First'.
Re: Re: Re: Problem with assignment for class...
by davido (Cardinal) on Oct 04, 2003 at 21:46 UTC
    You still didn't read perlre as recommended, did you?

    "+" is a quantifier. It makes no sense as the only thing in a regexp. It has to modify something. Finding a nonsensical syntax within a regular expression will cause an error, because regular expressions are a built-in part of Perl.

    If you want to match the literal character "+" you can do so by escaping it, or by metaquoting it:

    s/\+/ / # or s/\Q+\E/ /

    But you really shouldn't be parsing your own CGI parameters. Use the CGI.pm module, at least until you understand why this advice is important.

    As for additional reading: The CGI.pm POD. And perlretut, and perlre, and perlrequick all provide good reading material on regular expressions, each targeting a different stage in your learning curve.


    Dave


    "If I had my life to do over again, I'd be a plumber." -- Albert Einstein
      I realized as soon as I posted my previous reply, that the '+' had to be entered as a '/+' for syntax reasons, the reason this wasn't readily aparent is because as I said... it's in my textbook. The textbook in question is "Weaving a Website" by Susan Anderson-Freed, and has actually been quite good to this point.
        Get a new textbook then, or just stick with the perl documentation