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 a filename
}
}
Jerry
Jon wrote:
>
> 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 do this for a bunch of different patterns (ex.
> ".txt", ".this", ".that"). How can I make what is inside the angle brackets
> a variable? I've tried to use eval to build my while statement and I can't
> make it work. Help Please?
>
> while(<*.txt>)
> {
> ### do stuff, given a filename
> }
>
> Jon
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]