>>>>> "KW" == Kenneth Wolcott <[email protected]> writes:
KW> Hi Harry; KW> On Mon, Mar 22, 2010 at 12:25, Harry Putnam <[email protected]> wrote: >> Harry Putnam <[email protected]> writes:But even then I still got what I >> needed... or until someone tells me >> its better to in this case not to use IO::Handle but stick with Jim >> Gs' suggestion: >> >> select LOGNAME; >> $|++; >> select STDOUT; KW> Which is what the Perl Cookbook suggests as well. the cookbook isn't always the best answer. check out how they suggest to read a file backwards. its poor design led me to code up File::Readbackwards. in this case they are wrong again. what if (albeit a rare condition) STDOUT wasn't the currently selected handle before that code ran? the correct way is to get the old handle from the select call (which returns it) and reselect it: my $old_handle = select LOGNAME ; $|++ ; select $old_handle ; as for its using symbolic handle names, that is old too. in any case using the OO form is even better. and another point, never mention the name FileHandle. it is a very obsolete module and it only wraps IO::Handle anyhow these days. never a need for it, nor to ever mention it. uri -- Uri Guttman ------ [email protected] -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
