SPUG: Filehandes -- slurping up the files in \folder\*.htm?

Dean Hudson dean at ero.com
Thu Feb 10 18:49:35 CST 2000


On Wed, 9 Feb 2000, Greg Mushen wrote:

> # This will open the directory
> opendir(DIR, "<your-dir>") or die "Can't open dir: $!\n";
>  
> # This will go through each file in that directory.
> while(defined ($file = readdir(DIR))) {
>             open(FILE, "$file");
>             do whatever else here
> }

Or if you're feeling slightly more "fast & loose":

my $dir = "/your/dir/here";
while ( my $file = <$dir/*> ) {
    # process file
}

dean.
--
dean hudson,			<deanh at ero.com>	
research fellow,	esoteric research organization



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list