I am not sure how things changed
please see my output
1348 4887.15 -----> this is the line i copy pasted no operation
Checking amnt before conversion 4887.15,
Checking amnt after rounding 4887.15,
Checking amnt after conversion 488715,
488714 i m checking amount before padding,
0000000000488714 i m checking amount after padding,
why it
print " Checking amnt before conversion $amt,\n";
$amt= sprintf("%.2f",$amt);
print " Checking amnt after rounding $amt,\n";
$amt = $amt*100;
print " Checking amnt after conversion $amt,\n";
sub amnt($amn)
{
my $amount=$_[0];
$amount=int($amount);
say "$amount i m checking amount before padding,\n";
#my $padamnt = sprintf("%016.0f",$amount);---> currently commented to
+check integer effect.
my $padamnt = sprintf("%016d",$amount);
say "$padamnt i m checking amount after padding,\n";
return $padamnt;
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|