Hi
Please help if you can.
Kind Regards
Stuart Clark
How do I add all the number between the "a" and the "z"
My output file only gives me the instances of the matching pattern and
not the total
# start of file test
30000034364717283459322a15.32zM 042001H
30000045434551648534245a243.56zM 040532H
30000053232540927543293a2.45zM 040332H
# end of file test
open (IN,"test") || die "Could not open the test file\n";
open (OUT,">total") || die "Error could not create the output
file\n";
while (<IN>) {
$total += /a([\d.]+)z/;
}
print OUT $total;
close(IN) || die "Error cannot close test file\n";
close(OUT) || die "Error cannot close output file\n";
# output file must look like this
261.33
# At the moment it gives me this
3