[Nashville-pm] How do I handle this?

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Thu Dec 16 10:31:56 CST 2004


On Thursday 16 December 2004 00:35, David R. Wilson wrote:
> I have a string that has multiple lines including cr/lf sequences
> embedded in the string.
>
> I am trying to send this to a file ie:
> open (FILE,">file.txt");
> print FILE "$string";
> close (FILE);
>
> if I add in a line "print $string" it will output the data to the
> screen.  What is a good way around this?

You can use select to change the default output to your filehandle,
instead of STDOUT, i.e. select FILE;.  Note that you can still write to
STDOUT by specifying it, the same way you would a file, i.e.
print STDOUT "something\n";

-- 
Tilghman


More information about the Nashville-pm mailing list