home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5544 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.5 KB  |  37 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!convex!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: fast way to get number of elements in an assoc array?
  5. Originator: tchrist@pixel.convex.com
  6. Sender: usenet@news.eng.convex.com (news access account)
  7. Message-ID: <1992Aug27.152838.17427@news.eng.convex.com>
  8. Date: Thu, 27 Aug 1992 15:28:38 GMT
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. References: <1992Aug27.032106.20515@CS.ORST.EDU> <MEISSNER.92Aug27103724@tiktok.osf.org>
  11. Nntp-Posting-Host: pixel.convex.com
  12. Organization: Convex Computer Corporation, Colorado Springs, CO
  13. X-Disclaimer: This message was written by a user at CONVEX Computer
  14.               Corp. The opinions expressed are those of the user and
  15.               not necessarily those of CONVEX.
  16. Lines: 19
  17.  
  18. From the keyboard of meissner@osf.org (Michael Meissner):
  19. :In article <1992Aug27.032106.20515@CS.ORST.EDU> jacobsd@prism.cs.orst.edu (Dana Jacobsen) writes:
  20. :
  21. :| 
  22. :|   Is there a function akin to $#array that works on associative arrays?
  23. :
  24. :    int (scalar (%array))
  25.  
  26. Um, that doesn't tell you how many keys are in the array, just 
  27. how full the hashtable is.  You have to do something more like
  28.  
  29.     $count++ while each %array;
  30.  
  31. --tom
  32. -- 
  33.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  34.  
  35.     char program[1];        /* Unwarranted chumminess with compiler. */
  36.         --Henry Spencer in his regcomp.h regular expression lib
  37.