http://www.perlmonks.org?node_id=1148141


in reply to How do I skip reading files further with missing data?

Use the directory functions: opendir, closedir and readdir.

opendir DIR, $dir or die "cannot open dir $dir: $!"; my @filenames= readdir DIR; closedir DIR;
This will read the list of file names into the @filenames array.

You can use the scalar Range Operators

open my $fh, "<", $file or die $!; while (<$fh>) { print if /+=======+=======+============+============+============+ +/ .. /+-------+-------+------------+------------+------------+/; }
OR

use flag like below,

foreach my $file (@filenames) my $filepath = "/FILEPATH/$file"; open my $fh, "<",$filepath or die("could not open log file: $!"); my $in = 0; while(<$fh>) { $in = 1 if /+=======+=======+============+============+=========== +=+/; print if($in); $in = 0 if /+-------+-------+------------+------------+----------- +-+/; }
Note: Not Tested

All is well. I learn by answering your questions...