![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Append string to columns from 2 files | karthikn7974 | Shell Programming and Scripting | 3 | 04-28-2008 09:32 AM |
| append a string to a grep result | melanie_pfefer | Shell Programming and Scripting | 8 | 03-19-2008 07:19 AM |
| simple question on string concat | the_learner | High Level Programming | 2 | 08-23-2007 11:09 PM |
| Append string in all rows | Rock | Shell Programming and Scripting | 7 | 12-01-2006 02:46 AM |
| append esc string | beilstwh | Shell Programming and Scripting | 2 | 05-11-2005 01:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
perl: simple question on string append
I want to append a decimal number to a string. But I want to restrict the number to only 2 decimal points
for e.g: my $output = "\n The number is = "; my $number = 2.3333333; $output = $output . $number; But I want the $output as: "The number is = 2.33"; and not 2.3333333 (I do not want to print $output right now.. I just want it to have the number with only 2 decimal points) can anyone please helpout.. Thanks !!!!!!!!!!!! |
|
||||
|
Code:
$result = sprintf("%.2f", $number);
|
| Sponsored Links | ||
|
|