open.
(See also tgent in TSA).
# from PCB 16.5
head(100);
sub head {
my $lines = shift || 20;
return if $pid = open(STDOUT, "|-");
die "cannot fork: $!" unless defined $pid;
while (<STDIN>) {
print;
last if --$lines < 0;
}
exit;
}
Forward to Data-Oriented Programming
Back to Break Complex Tasks Up
Up to index
Copyright © 1998, Tom Christiansen
All rights reserved.