in reply to problem with redirection and piping
#!/usr/bin/perl use strict; use warnings; use File::Tee qw(tee); tee('STDOUT', '>>', 'stdout.txt'); $| = 1; my $i = 0; $SIG{'INT'} = 'handler_of_int'; sub handler_of_int { close('STDOUT'); exit(0); } while (1) { print STDOUT ++$i, "\n"; sleep (1); }
|
|---|