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 }
Regards
mwa
In reply to Re^3: Multiplication problem
by mwah
in thread Multiplication problem
by John Vanbeek
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |