Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-23-2005, 09:26 AM   PM User | #1
rockdoc
New Coder

 
Join Date: Aug 2004
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
rockdoc is an unknown quantity at this point
Number crunching and textareas

Hello,
Is it possible to paste a line of numbers into a textarea (see example below) and when submitted, have the perl script treat each line as a separate value?

<form>
<textarea>
23
56
78.5
12
</textarea>
</form>

Any advice (and code for doing so) would be much appreciated.
rockdoc is offline   Reply With Quote
Old 08-23-2005, 10:51 AM   PM User | #2
shyam
Senior Coder

 
shyam's Avatar
 
Join Date: Jul 2005
Posts: 1,563
Thanks: 2
Thanked 163 Times in 160 Posts
shyam will become famous soon enough
if the $text comes out like this 23\n56\n78.5\n12 u can do this
Code:
$text = $cgi->param("textarea1");
@splits = split("\n", $text);
shyam is offline   Reply With Quote
Old 08-23-2005, 04:44 PM   PM User | #3
rockdoc
New Coder

 
Join Date: Aug 2004
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
rockdoc is an unknown quantity at this point
Thanks shyam,
That did it
@Nums = split(/\n/, $list); #split textarea value
rockdoc is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:54 AM.


Advertisement
Log in to turn off these ads.