I have a number of pet hates when it comes to coding. Amongst these is the use of temporary files to capture the output of commands being executed from perl.
Above is a very short example of the code I see people writing. I dislike the use of system() as I have seen it produce unexpected results in a win32 environment when you call your perl script from a non-standard command shell. I’m not overly keen on the use of the open command and file globs. I prefer to use the IO::File package and, rather than use a temporary file to capture the output, I pipe the output allowing my code to parse it as it is produced.
Using the above code, I have no temporary files and do not have to wait for the command to finish in order to parse the output.
No related posts.
Follow me on Twitter.
Grab my RSS Feed.