Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: print the output on the screen and to a file

by ramlight (Friar)
on Mar 30, 2012 at 12:59 UTC ( #962598=note: print w/replies, xml ) Need Help??


in reply to print the output on the screen and to a file

One other possibility is consolidate all for your print statements into calls to one central printing function that prints to both the screen and the file. This has the advantage that all of your I/O is passes through a single function. If, sometime in the future, you want to change how you do your output (use one of the Log:: modules or some similar change) then your changes are limited to one routine.

Such a change is simple to implement at the start of development, but it is a large, time-consuming, and error-prone task when applied to existing code. (I've had to do both.)

  • Comment on Re: print the output on the screen and to a file

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://962598]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-08-08 09:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?