I tried to run perlopentut example for STDOUT processing
but got just this:

=========Beginning of the citation==============
'-' is not recognized as an internal or external command,
operable program or batch file.

=========The end of the citation================

I use windows xp, activestate perl build 804.

Can anyone explain why I'm getting this error?

I know that windows version of perl supports forking,
but does that error mean it does not support forking
with open?

How can I alternatively intersept STDOUT?


=========Beginning of the citation==============
#! c:/perl/bin/perl.exe -w

head(100);

while (<>) {
    print;
}

sub head {
    my $lines = shift || 20;
    return unless $pid = open(STDOUT, "|-");
    die "cannot fork: $!" unless defined $pid;
    while (<STDIN>) {
        print;
        last if --$lines < 0;
    }
    exit;
}
=========The end of the citation================


--
With best regards, Vyacheslav Nadvorny.  E-mail: [EMAIL PROTECTED]



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to