Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Processing a multiple="multiple" <select>

by snopal (Pilgrim)
on Sep 20, 2007 at 13:47 UTC ( #640124=note: print w/replies, xml ) Need Help??


in reply to Processing a multiple="multiple" <select>

There is nothing wrong with not using the CGI module, but it has done most of the work for you.

As far as your code, $payload =~ tr/+/ /; should really use a regex to detect multiple parameters, and an assignment to an array. It's going to take additional logic to handle the contents of your payload when the results are not a SCALAR type, as in multiple select results.

  • Comment on Re: Processing a multiple="multiple" <select>

Replies are listed 'Best First'.
Re^2: Processing a multiple="multiple" <select>
by jpk236 (Monk) on Sep 20, 2007 at 13:53 UTC
    Is there any benefit to using s///g over tr///, in this context?

    I figured that tr/// would be less "expensive" since it's designed to only do character matching.

    - Justin

      Since you brought it up, 'sed' style matching is too heavy. All you want to do is detect the situation of multiple responses.

      if ($payload =~ /+/) { # process as list }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://640124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2020-10-28 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (264 votes). Check out past polls.

    Notices?