in reply to Order of output when switching filehandles

Instead of using tee, have you considered just printing directly to the file? I assume you are wanting the results to print to screen as well as to a log file. Why not do something like this:
open(FILE, ">$name") or die "Failed file open: $!\n"; my $stmt = $dbh->prepare("$sql") or die $DBI::errstr; # $sql takes 30- +40 secs. to run $stmt->execute() or die $DBI::errstr; while (my @array = $stmt->fetchrow()) { print; print FILE "$_"; } $stmt->finish(); close(FILE);
I didn't test this, but I'd bet that it's faster than running tee -- not to mention quite a bit easer to customize.
Hope that helps,
Shendal

Replies are listed 'Best First'.
RE: Re: Order of output when switching filehandles
by Cirollo (Friar) on Aug 14, 2000 at 22:52 UTC
    I ended up using tee because I use more print's than are in this example, and it becomes pretty unwieldy when you have to duplicate them all.