On Sep 18, [EMAIL PROTECTED] said:
>open my $self, $from, @_ or croak "can't open $from@_:$!";
>" ... the my $self furnishes undefined scalar to open, which knows to
>autovivify it into a typeglob. .... " and further mentions autovivifying a
When you use an undefined value as a reference, Perl creates that
reference for you automatically. THAT is autovivification. Thus, when
you do:
my $x;
$x->{foo} = 10;
$x->{bar}[5] = 20;
You've autovivified $x as a hash reference from the second line, and
autovivified $x->{bar} as an array reference on the third line.
When you do:
open my($foo), $path;
Perl is expecting a typeglob. If you give it an undefined value, it
autovivifies the typeglob reference, so *$foo is the filehandle. However,
references to filehandles are accepted wherever a filehandle is, so you
can just use $foo and get away with it.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]