princepawn has asked for the wisdom of the Perl Monks concerning the following question:
The first thing I think I know. Typeglobs are containers holding references to each of the 7 perl types for a particular variable name. They only exist for package variables. Typeglobs do not exist for lexical variables. Since the only two types of variables in Perl are lexical and package, one can say that 1 of the 2 has typeglobs as its storage support.
Now for some questions. In this slide gnat says:
# Perl lets you use a glob wherever you would use a filehandle, so glo +bs are often used to pass filehandles to a subroutine: open(HANDLE, $filename) or die; mysub(*HANDLE);
That's all well and good. And I assume mysub looks like this:
But what happens when you want to pass a format or dirhandle to a subroutine instead of a filehandle.sub mysub { my $fh = shift; while (<$fh>) { ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: typeglob questions
by diotalevi (Canon) on Sep 27, 2002 at 07:04 UTC | |
|
Re: typeglob questions
by broquaint (Abbot) on Sep 27, 2002 at 09:31 UTC | |
|
Re: typeglob questions
by flocto (Pilgrim) on Sep 27, 2002 at 10:26 UTC | |
|
Re: typeglob questions
by shotgunefx (Parson) on Sep 27, 2002 at 09:18 UTC |