in reply to saving search results to file

Well yes, you can do something like that, but the idea is to not have to loop through the handles manually every time you want to print.

Replies are listed 'Best First'.
Re^2: saving search results to file
by eXile (Priest) on May 04, 2005 at 02:23 UTC
    if you wrap this code into a subroutine, and have a global array of filehandles you wouldn't have to loop through the handles manually, this was just a showing-the-concept.

    I'd become something like:

    <open filehandles here ...> my @global_filehandles = qw(STDOUT STDERR FILE); printh("look mom, printed to 3 filehandles!\n"); sub printh { my $text = shift; foreach my $fh (@global_filehandles) { no strict 'refs'; print $fh $text; use strict; } }