SPUG: system() eating STDIN, how to avoid?

Adam Monsen haircut at gmail.com
Fri Jul 1 12:18:22 PDT 2005

On 6/30/05, James Moore <james at banshee.com> wrote:
> Something in the system() call seems to be eating from standard input,
> though.

I'm unable to reproduce this.

I wrote the following script (called stdin_eat.pl):

use strict;
system('true') == 0 or die;
print <STDIN>;

I try the following:

$ echo -e "hello world\n" > test.txt
$ perl -w stdin_eat.pl < test.txt
hello world

Am I missing something?

Adam Monsen

More information about the spug-list mailing list