in reply to Question:
in thread Using (s)printf()

Use split() to get rid of it.

Replies are listed 'Best First'.
Re: Re: Question:
by Anonymous Monk on Jun 25, 2002 at 18:23 UTC
    sub _round {
    my $digits = shift;
    my $num = shift;

    my $add = 5 * (10 ** -($digits + 1));

    $num += $add;

    my ($int,$frac) = split /\./,$num;

    $frac = substr($frac, 0, $digits);

    $num = join '.', $int, $frac;

    return $num;
    }