in reply to Can I print the result to a file

If you have control over the shell, simply redirect output to a file or another process:

$ perl myprog.pl > output $ perl myprog.pl | less

If you need to print to a file from within the program, you'll have to close STDOUT and reopen it to a file. The shell's the way to do this.

Replies are listed 'Best First'.
Re: Re: Can I print the result to a file
by pzbagel (Chaplain) on Apr 30, 2003 at 23:35 UTC

    Or instead of reopening STDOUT you can change the format name to the name of the filehandle you want to print out to.

    open (FOO, "foo"); format FOO= blah blah write FOO;

    This will assume that you want to print format FOO to the filehandle FOO.

    Cheers