start page | rating of books | rating of authors | reviews | copyrights

Programming Perl

Programming PerlSearch this book
Previous: 3.2.75 index Chapter 3
Functions
Next: 3.2.77 ioctl
 

3.2.76 int

int 

EXPR

This function returns the integer portion of EXPR . If EXPR is omitted, it uses $_ . If you're a C programmer, you'll often forget to use int in conjunction with division, which is a floating-point operation in Perl:

$average_age = 939/16;      # yields 58.6875 (58 in C) $average_age = int 939/16;  # yields 58


Previous: 3.2.75 index Programming Perl Next: 3.2.77 ioctl
3.2.75 index Book Index 3.2.77 ioctl