Help for this page

Select Code to Download


  1. or download this
    use Interpolation '%:$$->$' => sub {sprintf '%'.$_[0], $_[1]};
    
    ...
    $x = 1.7;
    $name = "Leaveolus";
    print "Hello $%{'06d'}{$x} or $%{' 10.5f'}{$x}, $%{'20s'}{$name}, and 
    +so forth\n";
    
  2. or download this
    use Interpolation 'S' => sub {
        local $_ = sprintf("%.2f", shift());
    ...
    };
    #...
    print "And the total price is $S{$Price}.\n";