#!/usr/bin/perl use strict; use warnings; use FindBin; use File::Spec::Functions; use File::Basename; my @files; my $path = catfile(shift(@ARGV),"*.t"); @files = sort grep {!/00/ } glob($path); my $foo = <) { last if /\s*##########################/; } # did we either not find the start of the comment block or # find that the comment block starts too far down the file? FAIL! if ($. > 8 or eof $fh) { next; } while (<$fh>) { # found closing ########## - we got the comment - PASS! if (/\s*###########################/) { print "$output\n"; next FISH; } # comment ended without a ############ - FAIL! if (!/^\s*#\s*(.*)?/) { next FISH; } $output .= "$1\n"; } # reached end of file without ending comment - FAIL! } $foo = < # #=cut ENDOFDOC print map { s/#//g; $_ } $foo;