note
japhy
<b>Update:</b> I need to take a closer look at your code.
<br><br>
Could you explain, a bit more abstractly, what it is you are attempting to do? You want the lines which have ' 0.00' at column 118, correct?
<hr>
First, your bracing and indenting style leaves something to be desired. Here's how I'd write your code:
<code>
while (<TEST>) {
if (/NAME /../ADJ TO TOTALS:/) {
push @data, $_;
foreach my $data (@data) {
if ($data =~ /1235114182/) {
$lines .= $_;
my $zero = substr $lines, 118, 5; # <-- 5? or 4?
# you had '==', you want 'eq'
if ($zero eq "0.00") { print OUTPUT "@data \n"; }
@data = ();
$zero = $lines = "";
}
}
}
}
</code>
You were using == which is for strictly numeric data, but you want to use eq because you're looking specifically for the characters '0.00'. You either want to change your substr() to 4 characters, or else look for ' 0.00', I think.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-1936">
<hr/>
Jeff <tt><font color="#0000ff">[japhy]</font></tt> Pinyan,
[id://371157|P.L., P.M., P.O.D, X.S.]:
<a href="http://japhy.perlmonk.org/modules/">Perl</a>,
<a href="http://japhy.perlmonk.org/modules/Regexp-Parser/">regex</a>,
and <a href="http://lists.perl.org/showlist.cgi?name=perl5-porters"><tt>perl</tt></a>
<a href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=hacker">hacker</a>
<br>
<i>Nos autem praedicamus Christum crucifixum</i> (1 Cor. 1:23) - <b><a href="http://thecrossreference.blogspot.com/">The Cross Reference</a></b> (My Blog)
</div></div>
860485
860485