home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4921 < prev    next >
Encoding:
Text File  |  1992-07-23  |  1.5 KB  |  36 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!cs.utexas.edu!convex!convex!tchrist
  3. From: Tom Christiansen <tchrist@convex.COM>
  4. Subject: Re: # of files in directory
  5. Message-ID: <1992Jul23.201539.4416@news.eng.convex.com>
  6. Originator: tchrist@pixel.convex.com
  7. Keywords: Files, Perl, Directory, ls
  8. Sender: usenet@news.eng.convex.com (news access account)
  9. Nntp-Posting-Host: pixel.convex.com
  10. Reply-To: tchrist@convex.COM (Tom Christiansen)
  11. Organization: CONVEX Realtime Development, Colorado Springs, CO
  12. References: <1992Jul22.182940.1248@chpc.org> <1992Jul22.150613.26006@hemlock.cray.com> <1992Jul23.195931.20791@magnus.acs.ohio-state.edu>
  13. Date: Thu, 23 Jul 1992 20:15:39 GMT
  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. Lines: 17
  18.  
  19. From the keyboard of bobd@magnus.acs.ohio-state.edu (Bob DeBula):
  20. :To reduce it still further (this *is* PERL after all):
  21. :
  22. :opendir (FILE, "/usr/bin");
  23. :print "There are ", scalar(grep (!/^\./, readdir (FILE))), " files!\n";
  24. :
  25. :Now if I could just figure out how to embed the open in the print
  26. :statement.....
  27.  
  28. print "There are ", scalar grep(1,`ls /usr/bin/`), " files in /usr/bin.\n";
  29.  
  30. --tom
  31. -- 
  32.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  33.     I already have too much problem with people thinking the efficiency of
  34.     a perl construct is related to its length.  On the other hand, I'm
  35.     perfectly capable of changing my mind next week...  :-) --lwall
  36.