in reply to Re: Multiplication problemin thread Multiplication problem
The snippet translated to your script would read like:
#!/usr/bin/perl $price=17.95; $qtyx=3; $cost = VIEWPRICE( MAKEPRICE($price) * $qtyx ); print "Content-type: text/html\n\n"; print "total costs are $cost"; sub MAKEPRICE { (my $mp = sprintf "%.2f", (shift)) =~ tr/.//d; return $mp } sub VIEWPRICE { my $vp = sprintf "%03d", (shift); $vp =~ s/(..)$/.$1/ or $vp = sprintf "%.2f",$vp; return $vp } [download]
Regards
mwa