home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4958 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  1.6 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!apple!constellation!convex!tchrist
  2. From: tchrist@convex.COM (Tom Christiansen)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: # of files in directory
  5. Message-ID: <1992Jul25.020342.2579@news.eng.convex.com>
  6. Date: 25 Jul 92 02:03:42 GMT
  7. References: <1992Jul23.211249.21744@magnus.acs.ohio-state.edu> <1992Jul23.225715.21531@news.eng.convex.com> <SBO.92Jul24095759@froh.vlsi.polymtl.ca>
  8. Sender: usenet@news.eng.convex.com (news access account)
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. Organization: CONVEX Realtime Development, Colorado Springs, CO
  11. Lines: 27
  12. Originator: tchrist@pixel.convex.com
  13. Nntp-Posting-Host: pixel.convex.com
  14. X-Disclaimer: This message was written by a user at CONVEX Computer
  15.               Corp. The opinions expressed are those of the user and
  16.               not necessarily those of CONVEX.
  17.  
  18. From the keyboard of sbo@vlsi.polymtl.ca (Stephane Boucher):
  19. :>>>>> On Thu, 23 Jul 1992 22:57:15 GMT, Tom Christiansen <tchrist@convex.COM> said:
  20. :
  21. :  >     print "There are ", 
  22. :  >         scalar(opendir(F,"/usr/bin"),scalar(grep(!/^\./,readdir(F)))), 
  23. :  >     " files!\n"
  24. :
  25. :Tom? How did you manage to miss this one? And I tought you
  26. :where one of the great :-)
  27. :
  28. :with: 
  29. :    grep(!/^\./,readdir(F)) 
  30. :
  31. :you will miss all the files that start with a dot. It should
  32. :read:
  33. :
  34. :    grep(!/^\.{1,2}$/,readdir(F))
  35.  
  36. I thought about that, but was emulating ls as the original poster
  37. also appeared to be doing.
  38.  
  39. --tom
  40. -- 
  41.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  42.  
  43.  
  44.     "That must be wonderful!  I don't understand it at all."
  45.