Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
    my $price2   = sprintf("%.0f",100.50);
    print "$price1\n";  # price1  has rounded
    print "$price2\n";  # but price2 hasn't , Why?
    
  2. or download this
    sub round {
      my $f = @_;
      return int($f + .5);
    }