in reply to How do I skip reading files further with missing data?
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 /+-------+-------+------------+------------+----------- +-+/; }
All is well. I learn by answering your questions...
In Section
Seekers of Perl Wisdom