[EMAIL PROTECTED] wrote:
I have the file as attached and I want to take 104 and 356 to get a sum.
Here is my code:


while (<FF>) { if ( $. > 6 ) { if ( $_ !~ "ANR*" or $_ !~ "ANS*" ) { print FFF $_; } } next unless $_ /^[a-zA-Z0-9]$/ { print $_; } }


The pseudocode would be: skip lines only if $_ begins with a letter and ends with a number or visa versa, then add 104 and 356. OR just add 104 and 356 b/c I still need to keep all the entries as seen in column 0.


my $total;

while ( <FF> ) {
    /^\s+(\d+)$/ and $total += $1;
    }

print "Total = $total\n";



John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to