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 ;-)