in reply to How do I determine if a variable contains a type glob?
reftype(\$s) eq 'GLOB' will be true if and only if $s contains a glob.
$ perl -MScalar::Util=reftype -e' my $s = *STDOUT; CORE::say reftype(\$s) eq "GLOB"; ' 1
reftype($s) eq 'GLOB' will be true if and only if $s contains a reference to a glob.
$ perl -MScalar::Util=reftype -e' my $s = \*STDOUT; CORE::say reftype($s) eq "GLOB"; ' 1
This is what open(my $fh, ...) places in $fh.
$ perl -MScalar::Util=reftype -e' open(my $s, "<&", *STDOUT) or die $!; CORE::say reftype($s) eq "GLOB"; ' 1
|
|---|