[thelist] Perl program question
Mark Groen
evolt at markgroen.com
Fri Jun 9 12:24:16 CDT 2006
On Fri, 2006-06-09 at 12:49 -0400, Portman wrote:
> I wrote a Perl program for a client a while ago and she recently called
> me to say that it is not calculating the shipping correctly. The
> shipping is calculated by taking a percentage of the total (depending on
> location) plus a $5 shipping and handling fee. I wrote the program so
> that the person would only be able to return to the cart after choosing
> a state and clicking calculate. I have been through the code over and
> over and cannot figure out what is wrong. If anyone is able to help it
> would be much appreciated.
>
> The script is at http://www.starqualitydesigns.com/blums/ship.cgi and
> can be seen in action at http://www.blumspapergoods.com (add something
> to the shopping cart and go from there). Please remember that this is a
> live site.
# Methinks you need to find out if this returns null:
my $selectedState=$q->param('state');
# then
else { something - see below }
# before you do this
my $shippingCharge=$shipcost{$selectedState}*$1+5;
# Multiply total by percentage and add $5 for shipping
# my $grandTotal= ($shippingCharge*$1)+6;
Hope that makes sense?
Also,
if ($selectedState eq '') then this part instead of being empty/false would be true and your calculation appears.
Not too familiar with perl, maybe that helps some though...
--
cheers,
Mark
More information about the thelist
mailing list