Hello all,
I've constructed a perl script which takes number from a large text file
and prints them as well as manipulates them later on. I've use a crude
way of getting the data but it's working for one set of files but not the
other. What happens is that it reads in the numbers until there is a
negative number. When it reaches a negative number, it places the
remaining text in that variable.
Here's a sample of the text file and the program where that data should be
read.
#sample of the text
Nitrogen 0.0 -5.78 0.0 0.0 0.0
#sample of the program.
while(<COMP2FILE>){
if (/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*)
*([0-9.\-]*)
/) {
if ($2 <= 0.0) {
$name = $1; $nitrogen1 = $2; $nitrogen2 =$3; $nitrogen3 = $4; $nitrogen4 =
$5;
$nitrogen5 = $6;}}
}
I thoguht placing the \- would get rid of the problem but it didn't.
So, the end result is that $nitrogen1 = 0.0 and $nitrogen2 = -5.78 0.0
0.0 0.0. the other variables after that are undefined.
If anyone can help out with this problem, that'd be great. Thanks for
your help.
Sincerely,
Brent Buckalew