There are only 6 globs slots and they are
SCALAR, ARRAY, HASH, IO, FORMAT and
CODE, so I can only assume by
*glob{FILEHANDLE} you mean
*glob{IO}. The
*glob{IO} slot holds the reference to the
IO object associated with a glob's filehandle (assuming it exists) e.g
open(FH, $0);
print "*FH IO slot holds - ", *FH{IO}, $/;
__output__
*FH IO slot holds - IO::Handle=IO(0x8107e4c)
Not meaning to plug (but will anyway) I'd recommend
Of Symbol Tables and Globs for more info on globs and glob slots.
How/where/why it is used? Please give me example.
Accessing glob slots directly is very rarely done, and when it is, it's usually for doing low-level code like writing
Exporter type code. Here's a simple demo of such code (if somewhat contrived)
sub import {
my $pkg = caller;
## import only filehandles
*{"$pkg\::$_"} = *{__PACKAGE__."::$_"}{IO}
for keys %{__PACKAGE__."::"};
}
HTH
_________
broquaint
update: s/DIR/CODE/ + added example
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.