#!/usr/bin/perl
print "content-type: text/html\n\n";
use CGI::Carp qw( fatalsToBrowser );
use File::Find::Rule;
$string="\x0D\x0A";
#my @files = File::Find::Rule->file()->name('*.pl')->in('/home/cristofa/public_html/'); # set ->in('.') to start from current directory
my @files=('D:/home/cristofa/public_html/cgi-bin/dummy/testme.pl');
for ($x=0; $x<@files; $x++){
open THEFILE, "<$files[$x]";
$first_line = ;
print $first_line;
close THEFILE;
if (grep(/$string$/,$first_line)){
print File "$files[$x] is incorrect
";
# &correct_file;
}
}
sub correct_file{
open (FILE, "<$files[$x]);
while(){
$tmp.=$_;
}
$tmp=~s/[\n\r][\n\r]/\n/g;
open (FILE, ">$files[$x]);
print FILE $tmp;
close(FILE);
$tmp='';
}
print "All done";