Yoyoyo Yoyoyoyo wrote:
Hi all,

I am using the diamond operator to redirect input to my perl script.  I want to 
copy all of the input on to a single variable using the following subroutine:

sub getfile  # Copies the file redirected to this perl script to the varialbe $x
{
  my $x;
  local $/ = undef;
  $x = <>;
  return $x;
}

The problem is that when I try to print what the above subroutine returns, the program kindof hangs. That is, it doesn't just print the output and then send me back to the command line, instead I have to press Ctrl-c to break out of it, like it is expecting input from the keyboard.

If you're reading from STDIN, you have to send an end-of-file marker.  In 
Windows, press control-Z on an empty line.  In *NIX, control-D.


--
Just my 0.00000002 million dollars worth,
 Shawn

"For the things we have to learn before we can do them, we learn by doing them."
 Aristotle

"If you think Terrans are comprehensible, you don't understand them."
 Great Fang Talphon

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to