From: "Stuart Clark" <[EMAIL PROTECTED]>
> How do I distinguish between positive and negative values.
> 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
You are missing the "-" here ;-)
It should be
print OUT2 if /a(-[\d.]+)z/;
Also the braces are useless here. Unless you need to work with
the number some more.
Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]