in reply to Re^3: How do I determine if a variable contains a type glob?
in thread How do I determine if a variable contains a type glob?
And what do you think *fh is.
A glob, what you should have used instead of \*fh.
You don't (*CAN'T*) bless a var; only a reference to one!
Actually, you have that backwards. I've never seen a blessed reference. You have to pass a reference to bless, but it's the var that gets blessed. Otherwise, the following would fail:
sub foo { CORE::say "ok" } my %h; my $ref1 = \%h; my $ref2 = \%h; bless($ref1); $ref2->foo();
How can "the reference be blessed",
I said ref would fail if the glob is blessed.
$ perl -MScalar::Util=reftype -e' CORE::say ref(\*FOO); CORE::say reftype(\*FOO); bless(\*FOO); CORE::say ref(\*FOO); CORE::say reftype(\*FOO); ' GLOB GLOB main GLOB
|
---|