Results 1 to 2 of 2

Thread: CGI Q's

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2001
    Location
    UK
    Posts
    8

    CGI Q's

    Hi,

    A few Q's relating to some cgi problems which i would be grateful if u could solve:

    - How do i loop through a file and if the string is not in the flat file then to append the string to the end of the file?
    - How do i parse entered text and remove all extra lines and replace them with spaces?


    Thanks

  2. #2
    scoutt
    Guest
    sorry I don't have a clue on the first one, but the second one can go something like this

    # make conversion of the newline character to breaks and paragraphs.

    $as{'field_name'} =~ s/\n/-break-/g;
    $as{'field_name'} =~ s/-break--break-/<p>/g;
    $as{'field_name'} =~ s/-break-/<br>/g;
    $as{'field_name'} =~ s/ +/ /g;

    then you would write it to the file. is that what you're after?

Posting Permissions

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



Click Here to Expand Forum to Full Width