Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Problem is that the wrong answer comes out, and calling print "$file\n"; shows that each of the files are called twice??? any suggestions? Thanks,@files = grep /^output\d+$/, <output*>; foreach $file (@files) { open (IN, "<$file"); while ($input = <IN>) { print "$file\n"; ($x, $y, $z, $sum) = split (/\s+/, $input); $total += $sum; $i++; $div = $total/$i; $sqrt = sqrt($div); print "$total\n"; open (OUT2, ">RMSD$file"); print OUT2 $sqrt; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: files stored in an array
by Enlil (Parson) on Aug 08, 2004 at 16:40 UTC | |
by Anonymous Monk on Aug 08, 2004 at 16:50 UTC | |
|
Re: files stored in an array
by davido (Cardinal) on Aug 08, 2004 at 16:33 UTC | |
by ysth (Canon) on Aug 08, 2004 at 22:08 UTC | |
|
Re: files stored in an array
by saintmike (Vicar) on Aug 08, 2004 at 16:40 UTC |