Help for this page

Select Code to Download


  1. or download this
    my ($h,$m,$s) = ...;
    $m = "0$m" if $m < 10;
    $s = "0$s" if $s < 10;
    my $dur = "$h:$m:$s";
    
  2. or download this
    my ($h,$m,$s) = ...;
    my $dur = sprintf("%d:%02d:%02d", $h,$m,$s);
    
  3. or download this
    %d    Signed 32/64-bit integer
    %2d   ...space padded (on the left) to occupy (at least) 2 columns
    %02d  ...zero padded (on the left) to occupy (at least) 2 columns
    
  4. or download this
    print get_duration('s1');
    
  5. or download this
    print get_duration($durations{s1});
    
  6. or download this
    print get_duration(@{ $durations{s1} });