#!/usr/bin/perl -w print "Content-type: text/html\n\n"; use CGI::Carp qw(fatalsToBrowser); opendir(DIR, "."); @files = grep( /\.tmp/, readdir(DIR) ); @files = sort(@files); closedir(DIR); foreach $file(@files){ $found = 0; open(FOO, "$file") or die "Cannot open. $!\n"; while (){ print "Copying table from $file...
"; if ( $_ =~ m//ig){ $found = 1; } if ($found == 1){ open(FILE,">>filename2.txt") or die "Cannot open. $!\n"; print FILE $_; close(FILE); } if ( $_ =~ m//ig){ $found = 0; } } close FOO; }