One of the big problems here is that
== is used
for number equality, not string equality. Use
if ($discount eq '40+15')
To do what you are attempting in this line.
However, because things may change, this is probably not the
best way to approach what you are trying to do. What if
someday you need to be able to evaluate '35+15' or some other
such thing? If the discounts are always going to appear in
this format, you could do something like:
@discount = split(/\+/, $discount);
$discount = 1;
foreach (@discount) {
$discount*=$_/100;
}
$discount*=100;
and then do your quantity calculations.
-
HZ