tlemons has asked for the wisdom of the Perl Monks concerning the following question:

Hi I'm a Perl newbie. I'm trying to use IPC::Run from CPAN. The code snippet below is right out of theIPC::Run documentation:
use IPC::Run qw ( start pump finish ) ## Build the harness, open all pipes, and launch the subprocesses my $h = start \@cat, \$in, \$out ; $in = "first input\n" ; ## Now do I/O. start() does no I/O. pump $h while length $in ; ## Wait for all input to go ## Now do some more I/O. $in = "second input\n" ; pump $h until $out =~ /second input/ ; ## Clean up finish $h or die "cat returned $?" ;

When I try to compile this, I get:

syntax error at - line 5, near "my " (which is the third line in the program, above)

I've been staring at this for a while, and I just don't see the problem. If I create a short program that uses just the 'run' command, it compiles and exeuctes just fine.

Is 'start' conflicting with something else on my system (which is Windows XP)?

Sorry, I'm not sure how else to debug this.

Thanks! tl

20050217 Janitored by Corion: Put code in-between code tags

Replies are listed 'Best First'.
Re: 'syntax error' for IPC::Run
by saintmike (Vicar) on Feb 13, 2005 at 06:38 UTC
    You forgot the semicolon at the end of the use IPC::Run qw(...) line.