Aug 22, 2012, 2:04 AM
Post #4 of 8
Re: [kuldeek] Problem logging STDOUT in perl
[In reply to]
But my problem statement is different
It is partially different, because, if you don't check the return value of 'open', you can't say for sure whether the open call succeeded, and since your posting is about problems where the output is showing up in the "wrong" files, this is certainly related.
However there is one more point to it: Whenever you ask in a forum for help, you certainly won't throw in some piece of code and hope that a friendly soul will debug it for you. Instead, you will do as much as you can, and ask for help only for those parts of the codes where you are really stuck. With other words, you will try to rule out by yourself "obvious" problems, such as undefined values etc.
The best way to do it is - aside from checking the return values of functions - to use 'strict' and 'warnings'. Once your code runs with this enabled, it makes sense to focus on the remaining problem(s). In many cases, there won't be problems left anyway....