Help for this page

Select Code to Download


  1. or download this
    sub format_add{
      my ($x, $y) = @_;
    ...
      my $digs = length $x;
      sprintf("%0${digs}d", $ret );
    }
    
  2. or download this
      $a=0.5;    print ++$a; #prints 1.5
      $a='a0.5'; print ++$a; #prints a6 
         #(so ++ ignores the dot and squashes the 0)
      $a='2a';   print ++$a; #prints 3 
         #(because 2a in numeric context returns 2)