Well...I'd do something like this:

open(IN,"myFile.txt");

#by undefining the input separator (below), 
#we can read the whole file as one scalar
undef $/;  

my $fileContents= <IN>;
close(IN);

print<<eof;
<HTML>
<BODY>
<FORM>
Here's my file:
<textarea name="myTextArea">$fileContents</textarea>
</FORM>
eof

voila!

As for your second question, if you wanna strip spaces at the ends you could
do this

$myString =~ s/^\s+(.+?)\s+$/$1/g;

This says, if you see multiple spaces at the beggining or end of a string
with any  other characters in the middle, replace the whole thing with the
non-space stuff in the middle....

If you just want to remove spaces, do something like this:

$myString =~ s/\s+//g;

There are many other ways of doing this, too... if you need more help, tell
us specifically what you're trying to do...

-Peter



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 7:50 AM
To: [EMAIL PROTECTED]
Subject: Form TextArea loading


Hi all,


Can sombody tell me how to load the contents of a text file into a textarea 
of a form in cgi? thanks...

oh and also need to to remove blank spaces from a string non realated
though

Ambrose

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to