-
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 :D
-
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?