Re: File Handling question - easy

2001-08-03 Thread Michael Fowler
On Thu, Aug 02, 2001 at 03:00:24PM -0400, Bob Showalter wrote: > I played around with this a bit and found that: > >perl -e 'print scalar(glob("*")) for (1..2)' > > prints two different files, while > >perl -e 'print scalar(glob("*")), scalar(glob("*"))' > > prints the same file twice.

RE: File Handling question - easy

2001-08-03 Thread Bob Showalter
> -Original Message- > From: Michael Fowler [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 02, 2001 2:48 PM > To: Bob Showalter > Cc: [EMAIL PROTECTED] > Subject: Re: File Handling question - easy > > > On Thu, Aug 02, 2001 at 02:31:28PM -0400, Bob Sh

Re: File Handling question - easy

2001-08-02 Thread Michael Fowler
On Thu, Aug 02, 2001 at 02:31:28PM -0400, Bob Showalter wrote: > P.S. I'm surprised this works with while(). I didn't realize fileglobs > were magical inside while(), but it appears they are... Is this documented? Yes, perldoc perlop, in the I/O Operators section (5.6.1 version): A (file)g

RE: File Handling question - easy

2001-08-02 Thread Jon
Bob, I got it from "Perl Black Book" by S. Holzner, section on globs. Very very good book to learn Perl from, extremely easy to read, excellent for beginners and I'm not going to know this for a long while but I think it is an excellent book for intermediate Perl dudes too. End of section rea

Re: File Handling question - easy

2001-08-02 Thread Jerry Preston
Jon, Read all the files in the directory then go through them based on the file ext and do what you want. opendir( PROGRAM, "./" ); foreach $program ( readdir( PROGRAM )) { if( $program =~ ".txt" ) { ### do stuff, given a filename }elsif( $program =~ ".this" ) { ### do stuff, given

Re: File Handling question - easy

2001-08-02 Thread Jon
Bob-Mike-Jerry, Thanks guys Jon At 01:36 PM 8/2/01 -0500, Jerry Preston wrote: >Jon, > >Read all the files in the directory then go through them based on the >file ext >and do what you want. > > opendir( PROGRAM, "./" ); > foreach $program ( readdir( PROGRAM )) { > if( $program =~ ".txt"

RE: File Handling question - easy

2001-08-02 Thread Bob Showalter
> -Original Message- > From: Jon [mailto:[EMAIL PROTECTED]] > Sent: Thursday, August 02, 2001 2:03 PM > To: [EMAIL PROTECTED] > Subject: File Handling question - easy > > > I don't know if I sent my first email correctly. Sorry for > the repeat if I > did, I'm new :) > > Hello, > The

Re: File Handling question - easy

2001-08-02 Thread Michael Fowler
On Thu, Aug 02, 2001 at 11:03:23AM -0700, Jon wrote: > My problem is, I want to do this for a bunch of different patterns (ex. > ".txt", ".this", ".that"). You could say <*.txt *.this *.that>, or you can use opendir, readdir, and a regex (perhaps grep). > How can I make what is inside the angl