Hello all,

I've constructed a perl script to extract certain lines of data and print
them out and use them in a later analysis.  The catch I've run into is
that the style I used for the first batch doesn't work for
the second.  I was wondering if any of you had a better/different way of
getting the information.

Anyway, here's a portion of the input file.  I've added the <> to
highlight the perl script or input files.

>
Nitrogen 0.0  -5.78  0.0  0.0  0.0
>

Here's where the above text is read in.

>
while(<COMP2FILE>){

      if(/(Nitrogen) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*) *([0-9.\-]*)
*([0-9.\-]*)/)
      {
if ($2 <= 0.0) {
$name = $1; $nitrogenc1 = $2; $nitrogenc2 =$3; $nitrogenc3 = $4;
$nitrogenc4 = $5; $nitrogenc5 = $6;}}
}
>

What it's doing with the data is that it'll read in the numbers up to the
first negative number, then it just gives up and doesn't assign the -5.78
to $nitrogenc2 in the example above.  I thought that adding the \- in
the if conditional would correct the problem but it didn't.

If you have any suggestions for this problem, that'd be great.  Just two
facts of improtance: (1) this is my first perl script and (2) I'm an
astronomer and not a computer programmer.  The above is probably
uaesthetically pleasing but it just has to run.

Thanks for your help!

Sincerely,
Brent Buckalew

Reply via email to