Copied to the list, for they may be interested in this little known feature in Perl. At 14:52 -0400 1999.08.11, Paul Corr wrote: > *INPUT = *DATA{GLOB}; > >I understand these are typeglobs but where does 'GLOB' come from? Is >it some sort of reserved word like DATA? Is this in a POD somewhere? >I see STDIN, STDOUT, and STDERR in perlop.pod (and numerous books.) >DATA I picked up in my list reading. Is it documented somewhere? I am not sure where it is documented, but it is known. Basically, every typeglob (like *FOO) has several parts to it, which may or may not be filled. The array part of a typeglob is called ARRAY, the scalar is called SCALAR, and so on. For instance, to get the SCALAR value of *FOO, you can do: @FOO = (0..2); $FOO = 3; *BAR = *FOO; Now @BAR is the same as @FOO and $BAR is the same as $FOO. But you can do this, too: *BAR = \$FOO; That will make $BAR an alias to $FOO as before, but not affect @BAR at all. Then, you can do: *BAR = *FOO{SCALAR}; which is the same thing. I like it because it looks more like I am aliasing something. I actually made a mistake above, though. GLOB should have been IO or FiLEHANDLE (they are both the same thing). GLOB is just a pointer to the typeglob itself. So this is best: *INPUT = *DATA{IO}; That's the only way I can think of to get an alias to the filehandle. As noted before, you can do these: *BAR = \$FOO; *BAR = \@FOO; *BAR = \%FOO; But there is no similar notation for filehandles. So if you don't want to do: *BAR = *FOO; to get the filehandle, you can do: *BAR = *FOO{IO}; -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6']) ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org