On Fri, 17 Oct 2003 09:06:24 -0700, A L wrote: > Let's say there is a directory called Top. Within the Top directory, > there are 26 subdirectories named A-Z. Within each of those A-Z > subdirectories contain one or more filess that ends in .txt extension. > Now, to print out the content within all those .txt files, what can you > do to not type in each separate directory handle and file handle?
'perldoc File::Find' #!/usr/bin/perl # use strict; use warnings; use File::Find; find( \&show_file, '/home/Top' ); sub show_file { return unless ( /\.txt$/ ); if ( open(FILE, $_) ) { while ( <FILE> ) { print $_; } close( FILE ); } else { # Couldn't open the file } } -- Tore Aursand <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]