Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Textarea boxes in CGI

by cfreak (Chaplain)
on Jun 17, 2003 at 19:00 UTC ( [id://266597]=note: print w/replies, xml ) Need Help??


in reply to Textarea boxes in CGI

The newline character is determined by the sending system. On Win/DOS thats \n\r, on *nix its \n and Mac <= OS 9 I believe is \r\n but don't quote me on that (OS X is \n like all Unixes)

As for your problem: the textarea is going to be returned as a single string that contains newlines so chomp() would only get rid of the last one anyway. If you want the string as an array this should work:

my $textarea = $q->param('textarea'); my $textarea =~ s/\r//g; # get rid of any \r characters my @array = split(/\n/,$textarea);

Hope that helps

Lobster Aliens Are attacking the world!

Replies are listed 'Best First'.
Re: Textarea boxes in CGI
by cLive ;-) (Prior) on Jun 17, 2003 at 19:21 UTC
    I hate to burst your bubble, but Phoenix (Mozilla Firebird :) under Linux returns \r\n as well :)

    cLive ;-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2024-04-16 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found