note
injunjoel
Greetings,
Though this does not solve your problem think of it as a different approach to it.
I would suggest setting the input record separator to a different value to get your file to be read in differently.
Assuming your example file is representative of your input...
<c>
#!/usr/bin/perl -w
use strict;
#of course this assumes the example file is in the exact
#format expected. The following line is basically the
#line containing a lone 'c' at the beginning and a whole
#bunch of spaces (your comment cards).
#remember that $/ can't handle regexp... though it sure
#would be cooler if it did.
local $/ = "c ";
while (<DATA>){
print "\n=====chunk start=======\n";
print $_;
print "\n=====chunk stop=======\n";
}
#from the example data you gave.
__DATA__
m8 92234.30c 0.0071 92235.30c 0.9300 92238.30c 0.06289
8016.30c 2.0 42000.30c 2.5
c
c BeO(2.86) Axial Reflector TD=3.01 / 95%=2.86
m9 4009.30c 0.5 8016.30c 0.5
mt9 beo.01t
c
c BeO(?AllgenCalc) Radial Reflectpr TD=3.01 / 95%=2.86
m10 4009.30c 0.5 8016.30c 0.5
mt10 beo.01t
c
c He/Xe(.0218) (72/28) ~.55 mol/L at 300K,1.38MPa, 39.6 g/mol
m11 2004.30c 0.7
54124.30c 0.00027 54126.30c 0.00027 54128.30c 0.00576
54129.30c 0.07932 54130.30c 0.01224 54131.30c 0.06354
54132.30c 0.08067 54134.30c 0.03132 54136.30c 0.02661
c
c Sodium(0.929) RoomTemp = .97 g/cc, at melt = .929 g/cc
c Liquid = .929 - .000244*(t-371) (t in K) Handbook Ch&Ph
m12 11023.30c 1.0 $ Na (.929 g/cc) frozen/void
c
c Lithium(.515) RoomTemp = .534 g/cc, at melt = .515 g/cc
c Liquid = .515 - .000101*(t-454) (t in K) Handbook Ch&Ph
</c>
So essentially you can get the file read in in chunks and deal with each chunk with your regexp.
Oh and here is the output from above.
<c>
=====chunk start=======
m8 92234.30c 0.0071 92235.30c 0.9300 92238.30c 0.06289
8016.30c 2.0 42000.30c 2.5
c
=====chunk stop=======
=====chunk start=======
c BeO(2.86) Axial Reflector TD=3.01 / 95%=2.86
m9 4009.30c 0.5 8016.30c 0.5
mt9 beo.01t
c
=====chunk stop=======
=====chunk start=======
c BeO(?AllgenCalc) Radial Reflectpr TD=3.01 / 95%=2.86
m10 4009.30c 0.5 8016.30c 0.5
mt10 beo.01t
c
=====chunk stop=======
=====chunk start=======
c He/Xe(.0218) (72/28) ~.55 mol/L at 300K,1.38MPa, 39.6 g/mol
m11 2004.30c 0.7
54124.30c 0.00027 54126.30c 0.00027 54128.30c 0.00576
54129.30c 0.07932 54130.30c 0.01224 54131.30c 0.06354
54132.30c 0.08067 54134.30c 0.03132 54136.30c 0.02661
c
=====chunk stop=======
=====chunk start=======
c Sodium(0.929) RoomTemp = .97 g/cc, at melt = .929 g/cc
c Liquid = .929 - .000244*(t-371) (t in K) Handbook Ch&Ph
m12 11023.30c 1.0 $ Na (.929 g/cc) frozen/void
c
=====chunk stop=======
=====chunk start=======
c Lithium(.515) RoomTemp = .534 g/cc, at melt = .515 g/cc
c Liquid = .515 - .000101*(t-454) (t in K) Handbook Ch&Ph
=====chunk stop=======
</c>
Does that make sense?
<br />
<br />
-InjunJoel<br />
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-277600">
"I do not feel obliged to believe that the same God who endowed us with sense, reason and intellect has intended us to forego their use." -Galileo
</div></div>
691817
691817