I want to understand typeglobs better and write small programm:
use Symbol;
open F, '>', \my $var;
t( F );
t( \F );
t( *F );
t( \*F );
sub t {
my $fh = shift;
print ">>$fh<<" . ref( $fh ) ."\n";
}
The output is:
>>F<<
>>SCALAR(0x1e67fc8)<<SCALAR
>>*main::F<<
>>GLOB(0x1e53150)<<GLOB
Why GLOB is returned only in last case?
t( F )
: A string[1] isn't a reference to a glob.t( \F )
: A reference to a string isn't a reference to a glob.t( *F )
: A glob isn't a reference to a glob.t( \*F )
: A reference to a glob is a reference to a glob.