Use the directory functions: opendir, closedir and readdir.
This will read the list of file names into the @filenames array.opendir DIR, $dir or die "cannot open dir $dir: $!"; my @filenames= readdir DIR; closedir DIR;
You can use the scalar Range Operators
ORopen my $fh, "<", $file or die $!; while (<$fh>) { print if /+=======+=======+============+============+============+ +/ .. /+-------+-------+------------+------------+------------+/; }
use flag like below,
Note: Not Testedforeach 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 /+-------+-------+------------+------------+----------- +-+/; }
In reply to Re: How do I skip reading files with missing data?
by vinoth.ree
in thread How do I skip reading files further with missing data?
by Ppeoc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |