perlnewbie9292
Programmer
Hello Perl experts,
I was hoping someone can help me with the following problem which I am stuck and have not had much luck trying to get to work.
The problem that I am running into is that I only want to "print" if the file that I am reading contains the ^Subject and ^Content-Type strings, if the file does not have these strings then skip over it or don't print anything.
Any help would be greatly appreciated.
I was hoping someone can help me with the following problem which I am stuck and have not had much luck trying to get to work.
The problem that I am running into is that I only want to "print" if the file that I am reading contains the ^Subject and ^Content-Type strings, if the file does not have these strings then skip over it or don't print anything.
Any help would be greatly appreciated.
Code:
my $dir = "$ARGV[0]";
find(\&matchingFiles, $dir);
sub matchingFiles {
if ( (-f) && /^strrd-.*\.txt$/ ) {
my $filename = "$File::Find::name";
open(RDSFILE, "< $filename") or return(0);
print "$filename\n";
my $postHeader;
my $filecontents;
while (<RDSFILE>){
$filecontent = $_;
if ( 1 .. $content && /^Subject:/ ) {
$content += /^Content-Type:/;
print;
}
}
}
close(RDSFILE);
}