Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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; }

In reply to Re^2: Padding with sprintf changing number by sachin raj aryan
in thread Padding with sprintf changing number by sachin raj aryan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others examining the Monastery: (3)
    As of 2025-02-07 07:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Which URL do you most often use to access this site?












      Results (94 votes). Check out past polls.