--- David Gilden <[EMAIL PROTECTED]> wrote:
> Could you comment briefly on the use of
> select LOG;
from perldoc -f select:
select FILEHANDLE
Returns the currently selected filehandle.
Sets the current default filehandle for output, if FILEHANDLE is
supplied. This has two effects: first, a `write' or a `print'
without a filehandle will default to this FILEHANDLE. . . .
obviously, there's more. Go read over it =o)
but if you select(FILEHANDLE), then that becomes the default.
Then you can say
open LOG, ">$file" or die $!;
select LOG;
print "foo\n";
and instead of going to STDOUT (the usual default), it'll go into the
filehandle LOG and end up in $file.
In general, I advise against this sort of chicanery unless your program
logic really needs it. Don't use it just to save the keystrokes of
typing the filehandle. Explicitly putting the filehandle into your
print statements is more maintainable for the next poor schmuck....
__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/