Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool2.mu.edu!sdd.hp.com!wuarchive!julius.cs.uiuc.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.lang.perl Subject: Re: While learning PERL... a suggestion Keywords: perl file learn suggest Message-ID: <1991Jan21.201845.28080@ux1.cso.uiuc.edu> Date: 21 Jan 91 20:18:45 GMT References: <1991Jan19.003519.23569@ux1.cso.uiuc.edu> <11115@jpl-devvax.JPL.NASA.GOV> <118879@uunet.UU.NET> <1991Jan21.092204.11944@ux1.cso.uiuc.edu> <1991Jan21.174520.12207@iwarp.intel.com> Organization: University of Illinois at Urbana Lines: 46 merlyn@iwarp.intel.com (Randal L. Schwartz) writes: >Arrays of filehandles are not directly supported. You can use arrays >of values that are to be assigned into indirect filehandles, like so: > $indir = $filehandle[17]; > print $indir "This goes to the 17th filehandle"; >but you cannot directly do the dereferencing of the array and the I/O >in the same expression. My only comment is that this must be a very complex syntax to parse. The mere existance of space between the handle and the string above would separate things. I wonder if there are any cases where the data to be printed could be an expression with a unary prefix operator that could cause an apparent ambiguity as to look like a binary infix operator between the filehandle and the data, thus appearing to be an expression to be printed on STDOUT. >You could also futz with the namespace, like: > *HANDLE = $filehandle[17]; > print HANDLE "this goes to the 17th filehandle"; >but remember that this affects &HANDLE, %HANDLE, and @HANDLE as well. >(I understand that this is more efficient than the indirect filehandle >if you do more than one I/O per filehandle switch.) In what way does it affect them? I was getting the impression from the man pages that these name spaces were separate. This was discussed in the man pages with regard to passing by references, but I guess you are now filling in the ambiguities of its affect elswhere. I'm not up on subroutines yet (probably mostly due to not understand how the name space works). >By the way, in this syntax, the filehandle never hits the Perl >tokenizer, so you are not limited to a standard "name" for your >filehandle. You can use "\007smurf city u.s.a. 00001" as your >filehandle name, for example. My favorite is something like "0000001" >in a variable that is being automagically incremented, so I can >generate them on demand and know that they won't collide with other >symbol names in my namespace. -- --Phil Howard, KA9WGN-- | Individual CHOICE is fundamental to a free society | no matter what the particular issue is all about.