Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: How do I determine if a variable contains a type glob?

by ikegami (Patriarch)
on Dec 05, 2016 at 01:09 UTC ( [id://1177182]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1177182]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-03-28 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found