home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / perl / 7773 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.0 KB  |  51 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!darwin.sura.net!news.Vanderbilt.Edu!vuse.vanderbilt.edu!drl
  3. From: drl@vuse.vanderbilt.edu (David R. Linn)
  4. Subject: Query - arrays of files
  5. Message-ID: <C0r02A.526@vuse.vanderbilt.edu>
  6. Originator: drl@jester
  7. Sender: news@vuse.vanderbilt.edu
  8. Nntp-Posting-Host: jester
  9. Organization: Vanderbilt University School of Engineering, Nashville, TN, USA
  10. Distribution: na
  11. Date: Tue, 12 Jan 1993 15:51:45 GMT
  12. Lines: 37
  13.  
  14. I am having trouble attempting to use arrays of filehandles.  Is this
  15. supported in perl?  For more details, read on.
  16.  
  17. I am now using perl to generate my named/DNS files.  In an attempt for
  18. generality, I have added some #DNSInfo# comments to my host file that
  19. describe, among other things, which subnets of Vanderbilt's class B
  20. network belong to the School of Engineering.  I scan the whole file:
  21. processing the #DNSInfo# comments, ignoring other comments and
  22. collecting host info for later processing.
  23.  
  24. After the scan is complete, I know the number of subnet files for which
  25. I need to generate PTR resource records and I tried to create an array
  26. of file handles:
  27.  
  28.     # for now, I *know* @subnets == (100, 101, 102, 103)
  29.     for $subnet (@subnets) {
  30.         open($PTR[$subnet],">rev.$subnet");
  31.     }
  32.  
  33. I thought that this would given me an arry @PTR of file handles to my
  34. PTR RR files, one for each subnet.  I planned to write the PTR RR for a
  35. given host with a statement like
  36.  
  37.     printf $PTR[$subnet] "%s\t\tPTR\t%s\n",
  38.         $octet[3], "$canonical.$subdomian.$domain";
  39.  
  40. This didn't work and further reading has convinced me that it shouldn't
  41. have.  However, the idea of using an array of file handles is still
  42. appealing.  The problem comes in generating the file handle names.
  43. Would any of you more-experienced folks care to suggest a way to do
  44. this (or to explain why this is a bad idea)?
  45.  
  46.      David
  47. -- 
  48. David R. Linn, System/Mail/News Manager    | INET: drl@vuse.vanderbilt.edu
  49. Disclaimer: I speak only for myself    | Phone: [+1] 615-343-6164
  50.       "Some do, some don't and that's the way of the world."
  51.