in reply to modulo 1 (%1) and fractional part of a number

a much simpler way of getting the fractional part of a number than anything else I've seen

Have you seen $foo - int $foo? That's both simple and clear, no?

Replies are listed 'Best First'.
Re^2: modulo 1 (%1) and fractional part of a number
by Jenda (Abbot) on Sep 27, 2018 at 12:11 UTC

    Only for simple $foo.

    $foo->{bar}->baz( $bat, $ban, 5 * $bag) - int($foo->{bar}->baz( $bat, $ban, 5 * $bag))

    Ain't so nice anymore.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

      Gnarly expressions are gnarly. Luckily Larry gave us subroutines.

      sub decpart { $_[0] - int $_[0]; } my $part = decpart ( $foo->{bar}->baz( $bat, $ban, 5 * $bag) );