我想更好地理解 typeglobs 并编写小程序:
use Symbol;
open F, '>', \my $var;
t( F );
t( \F );
t( *F );
t( \*F );
sub t {
my $fh = shift;
print ">>$fh<<" . ref( $fh ) ."\n";
}
输出是:
>>F<<
>>SCALAR(0x1e67fc8)<<SCALAR
>>*main::F<<
>>GLOB(0x1e53150)<<GLOB
为什么只在最后一种情况下返回GLOB ?