Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

int

Truncates a numeric value toward zero.

Returns the integer portion of EXPR by truncating toward zero. If EXPR is already an integer (sv_iok), returns it unchanged. For floats, converts via trunc() as i64. Always returns an Iv.

Synopsis

my $n = int(4.9);      # 4
my $n = int(-4.9);     # -4
my $n = int;           # int($_)

See Also

abs, POSIX::floor, POSIX::ceil