Recently, a friend of mine --- a chemistry graduate student at a prestigious university --- was complaining that his advisor was forcing him to use C++ instead of Fortran. The problem: he needed to g/re/p an input stream, crunch some numbers, and produce some output. "It's so easy to use the Fortran system call; is there even a way to execute command-line programs from C++?"

That of course is the UNIX Philosophy: to build a bunch of fundamental, pipeable tools and then call them with exec and friends. In that same vein, Paul sends along the following Perl code he found, "written by an ex-coworker."

my $filesize = `wc -c $file | cut -c0-8 | sed 's/ //g'`;

According to him, this code has been "in production for well over a year" and is called (read: copy-and-pasted) thousands of times in the program. The best thing about copy-and-paste is that, if done right, you can easily find-and-replace. Changing the above code to ...

my $filesize = -s $file;

... cut 75 minutes off the average execution time of this particular program. (With no reference point, I don't know how good that is.)