Gossamer Forum
Home : General : Perl Programming :

Array Split/Multiple Textareas

Quote Reply
Array Split/Multiple Textareas
I've sort of doomed myself here...

I have a form parsing script that separates array data with a comma. In the script I'm running, I have a varied amount of textareas (depending on how many things the users want to review), all with the name 'desc.'

When this data gets passed to the parser, the script separates the data in each of the 'desc' textareas with a comma. Problem is, once in a while, I anticipate a user to use a comma in his/her review. This would split one (possibly more) of the responses into another whole array.

I'm just looking for a creative way to keep all that data to itself, without worrying about special characters. The form-parser will always split with a comma, so that is really out of the question.

I have tried to call each 'desc' a different number (i.e. desc[1] desc[2] etc.) but that doesn't work at all.

All I need is a little ingenuity, and for some reason, I don't have any right now.
Quote Reply
Re: [PLB] Array Split/Multiple Textareas In reply to
If you call all fields desc then then you can grab the data using CGI.pm

use CGI qw/:standard/;

my @fields = param('desc');

....that will put each description into a new array element...no need to split anything.
Quote Reply
Re: [Paul] Array Split/Multiple Textareas In reply to
Or choose a slightly more obtuse field separator to split on. :: has always been a favorite of mine. :)
Quote Reply
Re: [oldmoney] Array Split/Multiple Textareas In reply to
Yeah, I'm sort of partial to | or \. Smile

Aside from that, thanks for the help. I've ventured into territory that my perl books couldn't support me with...