in reply to Re: Multiplication problem
in thread Multiplication problem

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^3: Multiplication problem
by mwah (Hermit) on Dec 10, 2007 at 16:45 UTC

    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