Hi,
 
How do I distinguish between positive and negative values.
This is part of a merchant batch script.
The values are between the "a" and "z"
I want to make the refunds (negative values) go to one file
And the sales (positive values) got to another
 
Regards
Stuart Clark
 
 
# start of file test
30000034364717283459322a-15.32zM    042001H
30000045434551648534245a243.56zM    040532H
30000053232540927543293a-2.45zM    040332H
# end of file test
 
open (IN,"test")              ||  die "Could not open the test file\n";
open (OUT,">output_positive")      || die "Error could not create the
output file\n";
open (OUT2,">output_negative")      || die "Error could not create the
output file\n"; 
 
while (<IN>) {
 
print OUT if /a([\d.]+)z/; # this bit needs to determine the positive
values
 
print OUT2 if /a([\d.]+)z/; # this bit needs to determine the negative
values
 
}
 
close(IN)                       || die "Error cannot close test file\n";
close(OUT)                    || die "Error cannot close output file\n";
 close(OUT2)                    || die "Error cannot close output2
file\n";
 
# output_positive file must look like this
30000045434551648534245a243.56zM    040532H
 
# output_negative file must look like this
30000034364717283459322a-15.32zM    042001H
30000053232540927543293a-2.45zM    040332H
 


Reply via email to