use FileHandle; # Maybe should be File::IO ? if ( -t STDOUT ) { STDOUT->autoflush(1); } # OR: without FileHandle, save some RAM at the expense # of legibility: # braces keep "my" vars local here. { # Save the currently select:ed filehandle! my $saved_selected_fh = select STDOUT; if ( -t ) { ++$|; # turn on "autoflush" } }