
AWHF
Novice
Jul 3, 2007, 2:18 AM
Post #40 of 44
(12908 views)
|
#!/usr/bin/perl my $dir_A = "/eng/home/assignment/dir_A"; chdir($dir_A) || die "Can't chdir to $dirname: $!"; opendir(DIRA, $dir_A) || die "Can't open directory: $1"; my @docfiles = grep{/\.doc$/} readdir DIRA; close DIRA; @sortdoc = (sort @docfiles);open(FILE, $sortdoc); while (<FILE>) { s/(\w+)/$1/; if (/^::start/../^::end/) { push (@array, $1); } @sortdoc = (sort, @array); } my $dir_B = "/eng/home/assignment/dir_B"; chdir($dir_B) || die "Can't chdir to $dirname: $!"; opendir(DIRB, $dir_B) || die "Can't open directory: $1"; my @txtfilesfast = grep{/\_fast.txt$/} readdir DIRB; my @txtfilesslow = grep{/\_slow.txt$/} readdir DIRB; close DIRB; @sortfiletxtfast = (sort @txtfilesfast); open (FILE1, $txtfilesfast); while ($line1 =<FILE1>) { if($line1 =~/name\((\w+\)/) { push (@array1, $line1); } @sorttxtfast = (sort, @array1); }open (FILE2, $txtfilesslow); while ($line2 =<FILE2>) { if($line2 =~/name\((\w+\)/) { push (@array2, $line2); } @sorttxtslow = (sort, @array2); } this is part of my script, but i haven't test because i don't know how to continue my script to do the comparison. can u help me? btw...is my script correct?
|