#! perl -w scipt #### use strict; use warnings; #### my @files; my @List_of_commands; my $line; my $file; #### while (<*.sql>) { push (@files,$_); } #### my @files=<*.sql>; #### foreach (@files) { #### for (<*.sql>) { # I never use C ;-) #### $file = $_; #### for my $file (<*.sql>) { # I still prefer C orver C!! #### open (FILE, "<$file"); #### while (){ my $line = $_; #### if $line not =~ (/INSERT INTO Message_pool)/{ #Do nothing } #### #!/usr/bin/perl # UNTESTED! use strict; use warnings; open my $out, '>', "outfile.txt" or die "Can't open output file: $!\n"; select $out; @ARGV=<*.sql>; while (<>) { next unless /^.{0,50}CREATE TABLE \s ([A-Z|a-z|_]{5,40}) \s .{1,100}/x; print "if exists (select 1 from INFORMATION_SCHEMA.tables where table_name = '$1') DROP TABLE '$1'\n"; } __END__ #### #!/usr/bin/perl -ln use strict; use warnings; BEGIN {@ARGV=map glob, @ARGV} # You're under Win*, aren't you? next unless /$whatever (\w+) $whatever/; print "whatever: $1"; __END__