my $filename = time(); my $doc = ''; open (MYOUT, ">/mypath/$filename.html") or die $!; $doc .= "

Mydata....

"; $doc .= "

Myotherdata....

"; print $doc; # This goes to the web browser print MYOUT $doc; # This goes to a files close (MYOUT); #### my(@files, $file); opendir(DATADIR, "datadir"); @files = grep(/[0-9].html/,readdir(DATADIR)); closedir(DATADIR); foreach $file (@files) { if (-M "data/$file" > 30) { unlink("data/$file"); } }