karthikeyan wrote:

> Dear All,
> 
>  
> 
>   Here is my problem.
> 
>  
> 
>   $price = "19.99";
> 
>   $special_offer = "59.40";
> 
>   $period = "10";
> 
>   $temp = $period * $price;
>   $temp = $temp - $price;
>   $temp = $temp + $special_offer;
>   $hosting_price = $temp;
> 
>  
> 
>  
> 
>   Here $hosting_price displays 239.31 which is fine.
> 
>  
> 
>   But when $period is set to 1 like this
> 
>  
> 
>  
>   $price = "19.99";
> 
>   $special_offer = "59.40";
> 
>   $period = "1";
> 
>   $temp = $period * $price;
>   $temp = $temp - $price;
>   $temp = $temp + $special_offer;
>   $hosting_price = $temp;
> 
>  
> 
>   Here $hosting_price displays 59.4 instead of 59.40.  How do I get that 
> one extra zeros.
> 
>  
> 
>   Are there any format specifier like C in perl.


perlfunc man page is your friend.  Look under (s)printf.

 

PS:  please post plain text only to this list.
-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/

_______________________________________________
Perl-Unix-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to