in reply to saving search results to file
topen('STDOUT','>file1.txt','>>file2.txt'); tprint("text\n"); tprint("text\n"); tclose(); BEGIN { my (@tp_h, $tp_s); sub topen { tclose(); for (@_) { if ($_ eq 'STDOUT') { $tp_s = 1; next; } open($_, $_) || die $!; push @tp_h, $_; } } sub tclose { close $_ for @tp_h; @tp_h = (); $tp_s = 0; } sub tprint { print @_ if $tp_s; print $_ @_ for @tp_h; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: saving search results to file
by Animator (Hermit) on May 03, 2005 at 16:58 UTC |