Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How can I tell if a variable is a FileHandle? (http://www.velocityreviews.com/forums/t890117-how-can-i-tell-if-a-variable-is-a-filehandle.html)

peterkayatwork@yahoo.com 01-11-2005 08:21 PM

How can I tell if a variable is a FileHandle?
 
I want to be able to tell if a variable is a FileHandle as opposed to a
string, hash, whatever. I know perl will tell me that it's a Glob:

If I do:

----code:
my $fh=\*STDIN;

print "Have [$fh]\n";
----end of code

it tells me
Have [GLOB(0x10131870)]

Thanks, perl.

If I do an "isa" to see if I've got a glob, what else could it be
besides a FileHandle?

Better yet, is there a more elegent way to tell if I've got a
FileHandle or a String?

--Peter


Anno Siegel 01-11-2005 10:33 PM

Re: How can I tell if a variable is a FileHandle?
 
<peterkayatwork@yahoo.com> wrote in comp.lang.perl.misc:
> I want to be able to tell if a variable is a FileHandle as opposed to a
> string, hash, whatever. I know perl will tell me that it's a Glob:


See the current thread "GLOB vs IO::Handle"

Anno

peterkayatwork@yahoo.com 01-13-2005 04:26 PM

Re: How can I tell if a variable is a FileHandle?
 
<blushes bring pink>

Thanks!



All times are GMT. The time now is 10:58 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.