in reply to Re: Re: STDIN following on?
in thread STDIN following on?
Well, try this little test:
eoftest.pl:#!/usr/bin/perl -w use strict; my @lines = <STDIN>; my $line = <STDIN>; print @lines; print "----\n"; print $line;
Typing in the input from the terminal works great. But here's the problem:
cat file | eoftest.plYou'll get your uninitialized value warning there. Reason? I think it has to do with the redirection (or to be more correct, piping) of STDIN when running your script. STDIN is now a pipe from "cat file" and can't have anything more read from it - causing the warning.
Update: You may want to do something like this:
open STDIN, "/dev/pts/0";
to reopen STDIN to the correct place.
His Royal Cheeziness
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: STDIN following on?
by tfrayner (Curate) on Aug 10, 2001 at 23:22 UTC | |
by dragonchild (Archbishop) on Aug 10, 2001 at 23:33 UTC | |
by tfrayner (Curate) on Aug 10, 2001 at 23:47 UTC |