#1
  1. No Profile Picture
    Simon Rickell
    Guest
    Devshed Newbie (0 - 499 posts)
    I am trying to write posted information from a form <textarea> into a file.

    For reading back from file I am using the following perl:-

    open(INFILE, "filename");
    @ALLRECORDS = <INFILE>;
    close INFILE;

    and processing each record with:-

    foreach $record (@ALLRECORDS) { }

    I cut out the newlines from the textarea value before writing the records to file with:-

    $textareavalue =~ s/n/#/g;

    This adds the # symbol where I would expect the newlines (n), but still the 'foreach $record' line takes each line of the textarea as a seperate record.

    Is there something else I have to cut out with the s/// command?
  2. #2
  3. No Profile Picture
    jamesh
    Guest
    Devshed Newbie (0 - 499 posts)
    You could try something like...

    foreach $record (@ALLRECORDS) {
    chomp; # remove a newline IF there is one
    $MOTHER_RECORD = $MOTHER_RECORD.$record."#";
    }

    James

IMN logo majestic logo threadwatch logo seochat tools logo