Next Trivial Utilities 36

ticker

     printf "%.2f", $fl/66 if $opt_p && $opt_l;
     printf "%s/s", rate(($fl-$fl1)/($time -$^T)) 
        if $time > $^T && $opt_r;
        sub rate {
          my $r = shift;
          my @m = (1000000000, 1000000, 1000, 1, .0001, .0000001);
          my @l = ('G', 'M', 'k', '', 'm', 'u');
          for (0 .. $#m) {
            if ($r >= $m[$_]) {
              return sprintf "%.2f%s", $r/$m[$_], $l[$_];
            }
          }
        }


Next Menu Copyright © 2012 M. J. Dominus