Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Syntactic Confectionery Delight
 
PerlMonks  

Printf/Sprintf Behavior Change

by stingles (Initiate)
on Sep 16, 2013 at 16:15 UTC ( #1054309=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use Data::Dumper;
    ...
    use Time::HiRes;
    $|=1;
    print sprintf("%0.02f",0.345);
    
  2. or download this
    
    $tprice = ($l[8]/$l[7])-$cpn->{'subprice'};
    if ($tprice < 1  && length($tprice) > 4) {
        print "SPRINTF - $tprice -  " . sprintf("%0.02f",$tprice) . "\n";
    }
    
  3. or download this
    $l[8] = 3.49
    $l[7] = 2
    $cpn->{'subprice'} = 1.4
    $tprice = 0.345
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1054309]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2014-04-19 14:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (481 votes), past polls