home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!cs.utexas.edu!convex!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: # of files in directory
- Message-ID: <1992Jul23.201539.4416@news.eng.convex.com>
- Originator: tchrist@pixel.convex.com
- Keywords: Files, Perl, Directory, ls
- Sender: usenet@news.eng.convex.com (news access account)
- Nntp-Posting-Host: pixel.convex.com
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Organization: CONVEX Realtime Development, Colorado Springs, CO
- References: <1992Jul22.182940.1248@chpc.org> <1992Jul22.150613.26006@hemlock.cray.com> <1992Jul23.195931.20791@magnus.acs.ohio-state.edu>
- Date: Thu, 23 Jul 1992 20:15:39 GMT
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 17
-
- From the keyboard of bobd@magnus.acs.ohio-state.edu (Bob DeBula):
- :To reduce it still further (this *is* PERL after all):
- :
- :opendir (FILE, "/usr/bin");
- :print "There are ", scalar(grep (!/^\./, readdir (FILE))), " files!\n";
- :
- :Now if I could just figure out how to embed the open in the print
- :statement.....
-
- print "There are ", scalar grep(1,`ls /usr/bin/`), " files in /usr/bin.\n";
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- I already have too much problem with people thinking the efficiency of
- a perl construct is related to its length. On the other hand, I'm
- perfectly capable of changing my mind next week... :-) --lwall
-