I don't know if I sent my first email correctly. Sorry for the repeat if I
did, I'm new :)
Hello,
The code below takes all files in my current directory that have filenames
ending with ".txt". Using this stuff I can loop through those files and do
what I need to do.
My problem is, I want to
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.
> -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
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
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
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
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"
> -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
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