Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    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);

  • #3
    New Coder
    Join Date
    Aug 2004
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks shyam,
    That did it
    @Nums = split(/\n/, $list); #split textarea value


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •