sasikumar has asked for the wisdom of the Perl Monks concerning the following question:

i need to split the content of the textarea into an array the text are contains several line of filenames i have to do it by spliting it with /n or something else. I tried with /n i was not able to get it can any one help me

Replies are listed 'Best First'.
Re: perl cgi text area split
by arden (Curate) on Mar 10, 2004 at 05:23 UTC
    sasikumar, first off, the end of line character is \n not /n. Next up, please show us some an example of the code you're having trouble with. I'm guessing that you're using either Tk or CGI, but since they are drastically different it would be helpful for us to see some of your code. . .

    - - arden.

Re: perl cgi text area split
by AcidHawk (Vicar) on Mar 10, 2004 at 06:51 UTC

    What are the filenames seperated with. I.e. is there a space between each filename in the textarea?

    Let's assume that this is the case. What you need is an array of all the filenames listed in the textarea. You need to read in each line seperated by the \n and then split the line by spaces. I.e.

    @line = split/\s/,$line_read_in;
    Then you might want to do a
    foreach my $filename (@line) { push (@list_of_filenames, $filename) }

    HTH
    -----
    Of all the things I've lost in my life, its my mind I miss the most.
Re: perl cgi text area split
by esskar (Deacon) on Mar 10, 2004 at 09:36 UTC