On Sat, May 05, 2001 at 02:46:46AM +0100, Michael G Schwern wrote:
> On Fri, May 04, 2001 at 04:42:07PM -0700, Nathan Wiger wrote:
> > I'm wondering what this will do?
> > 
> >    $thingy = $STDIN;
> > 
> > This seems to have two possibilities:
> > 
> >    1. Make a copy of $STDIN
> > 
> >    2. Read a line from $STDIN
> 
> While perhaps inconsistent, I'd really rather it did #2.  Here's the
> basic argument... compare how often you dup a filehandle with how
> often you read from one.  Duping is swamped by several orders of
> magnitude.  Dup with $fh = $STDIN.copy; (or whatever).  $line =
> $STDIN.next should still work normally.

How would you pass a handle to a subroutine, or store it inside
a hash or array ?

sub my_read {
  my $fh = shift; # whoops
}

I don't think it should do a dup(), but we do need to pass file handles around

Graham.

Reply via email to