in reply to Re^2: Editing a text file
in thread Editing a text file
When a script has a print command in it, how can you send that to a file?
From inside the script, you can print to any file that's been opened for output just by specifying the filehandle in the print command, before the first argument:
open SOMEFILE, '>', $filename; # Then... print SOMEFILE "Blah, blah, blah";
Alternately, from outside the script, when calling it, most operating environments provide a way to redirect the standard output of the script to a file. For instance, in a POSIX-like environment you can use tee or a shell redirection operator (usually > in most Unix-style shells, and also in DOS, OS/2, and NT, among others). If you need more specific information about this, you'll have to specify more details about your operating environment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Editing a text file
by appletag (Initiate) on Nov 21, 2006 at 12:19 UTC |