in reply to redirect STDERR to my log file, also funny *FOO notation.

The funny star notation copies the contents of the one typeglob into another. Perl uses typeglobs to hold global variables -- such as filehandles. It's more or less the same thing as duping the filehandle as with your open call. (It has the same effect on the filehandle, but it copies the other slots of the typeglob. Don't worry if you don't understand that; it probably has no effect on your program.)

Unless you're printing to the log file from multiple processes or you need the data RIGHT NOW, don't worry about unbuffering it. If you do need to unbuffer it, select the filehandle, then set $|, then select the previously-selected filehandle -- or use a module such as IO::Handle.

Replies are listed 'Best First'.
Re^2: redirect STDERR to my log file, also funny *FOO notation.
by JohnMG (Beadle) on Nov 15, 2005 at 15:34 UTC
    > The funny star notation copies the contents of the one
    > typeglob into another.

    Ah. I hadn't read much about typeglobs. Actually, the first time I saw the word "typeglob" and saw a *, I thought "fileglob". Also, a * outside of a string makes me think "dereference", but it looks like Perl thinks of it much like any other sigil.

    > don't worry about unbuffering it.

    Oh, ok. I think I see. The output to either filehandle (MY_LOG or STDERR) will stay in the same order just fine. I suppose that, after I've written a few lines to MY_LOG, if I then write to STDERR, the buffer will get flushed at that point anyway.