in reply to How do I pipe the output of a Perl program to something else?
This is also useful before you pipe to more(1). You can pipe to more(1) from within your program automatically if connected to a terminal:if (-t STDIN) { # output prompt }
At the end of the program:my $old_handle; if (-t STDOUT) { open (MORE, "| more") or die "No more $!\n"; $old_handle = select MORE; }
END { if (defined $old_handle) { select $old_handle; close MORE; } }
|
|---|