home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / perl / 7995 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  1.0 KB

  1. Path: sparky!uunet!tcsi.com!iat.holonet.net!news.cerf.net!usc!howland.reston.ans.net!paladin.american.edu!gatech!psuvax1!rutgers!igor.rutgers.edu!bakerst.rutgers.edu!steiner
  2. From: steiner@bakerst.rutgers.edu (Dave Steiner)
  3. Newsgroups: comp.lang.perl
  4. Subject: problem with on-the-fly names
  5. Message-ID: <Jan.26.13.13.51.1993.13626@bakerst.rutgers.edu>
  6. Date: 26 Jan 93 18:13:52 GMT
  7. Organization: Rutgers Univ., New Brunswick, N.J.
  8. Lines: 22
  9. Cc: steiner
  10.  
  11.  
  12. I'm using the following in a program:
  13.  
  14. eval "\$$pname{$o} = $_";
  15.  
  16. which works fine (I'm reading printcap-like entries and creating an
  17. assoc array for each printer with the various fields in the array).
  18.  
  19. The problem is that I don't know what fields are in the array and want
  20. to do something like
  21.  
  22. @o = keys eval "\%$pname";
  23.  
  24. but the syntax for keys doesn't allow this!  Is there some other way I
  25. can get all the entries in the assoc array?
  26.  
  27. ds
  28. -- 
  29.  
  30. Dave Steiner
  31. arpa: Steiner@BakerSt.Rutgers.Edu or Steiner@Rutgers.Edu
  32. uucp: ...{backbone site}!rutgers!bakerst.rutgers.edu!steiner
  33.