Y
yezi
Hi all: the following is my program , Do not know why it can not
open file (*.RD ) in the current directory. Thanks for any comments.
Thanks
24 opendir DIR,".";
25 @files = readdir DIR;
26 foreach $file (@files)
27 {
28 if ($file =~ /\.RD/)
29 {
30 $sitename=chomp($file);
31 print "$sitename";
32
33 # print "Processing $_.. to table...";
34 open myRDfile, $sitename or die "Error:Could not
open $sitename ";
35 while($line=<myRDfile>){
36 chomp($line);
37 @parts = split(/ /,$line);
38 if ($parts[0] !~ /Entropy/)
39 { for ($j=-$DT;$j<=$DT;$j++)
40 { if($parts[0] =~ /RD[$j]/) {
$RD[($j+$DT)] = $parts[2];} } # mapping
41 }
42 else {$entropy =$parts[2];}
43 }
44 close myRDfile;
45 #output the RD metric to default
46 @part1= split(/\./,$sitename);
47 print "$part1[0]\t";
48 for($i=0;$i<=(2*$DT);$i++) {print "$RD[$i]\t";}
49 print"$entropy\n";
50
51 }
52 }
53
open file (*.RD ) in the current directory. Thanks for any comments.
Thanks
24 opendir DIR,".";
25 @files = readdir DIR;
26 foreach $file (@files)
27 {
28 if ($file =~ /\.RD/)
29 {
30 $sitename=chomp($file);
31 print "$sitename";
32
33 # print "Processing $_.. to table...";
34 open myRDfile, $sitename or die "Error:Could not
open $sitename ";
35 while($line=<myRDfile>){
36 chomp($line);
37 @parts = split(/ /,$line);
38 if ($parts[0] !~ /Entropy/)
39 { for ($j=-$DT;$j<=$DT;$j++)
40 { if($parts[0] =~ /RD[$j]/) {
$RD[($j+$DT)] = $parts[2];} } # mapping
41 }
42 else {$entropy =$parts[2];}
43 }
44 close myRDfile;
45 #output the RD metric to default
46 @part1= split(/\./,$sitename);
47 print "$part1[0]\t";
48 for($i=0;$i<=(2*$DT);$i++) {print "$RD[$i]\t";}
49 print"$entropy\n";
50
51 }
52 }
53