Richard Gordon wrote: > > I am stuck trying to use a web page as something like a control interface > for a series of file maintenance scripts that I have created in MacPerl. > These basically loop thru text files stored in one folder, process them in > one way or another, and write the new versions out to another folder from > which they can be accessed via normal browser links. I know how to use > select() to direct the output to these new files, but how do I periodically > switch STDOUT back to the user's browser so that some kind of status > indicator can be displayed (e.g., "Now processing file My_File.html")? I > would also like to write to a log file and conclude the exercise by dumping > the log contents back into the browser. > > So, the question is once you've redirected output to a new file, how do you > switch it back to the original STDOUT target? My first guess is that you > would capture the state of STDOUT to a variable to begin with and then use > something like select($original_state), but I'm not at all clear on this. > Thanks. > select(FILEHANDLE) is used to select Perl's default filehandle. You don't need to use select() if you just specify the filehandle when you write to it, as in: print FH "This is printed to the filehandle FH.\n"; print OUT "This goes to OUT.\n"; So, usually, you don't need to switch default filehandles. If you do, though, and then you want to switch back to STDOUT, it's very simple: select(STDOUT); This is because select() does not actually change STDOUT; rather, it changes Perl's notion of the default filehandle. Ronald ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch