Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL int Function
Syntax
Definition and Usage
Returns the integer element of EXPR, or $_ if omitted. The int function does not do
rounding. If you need to round a value up to an integer, you should use sprintf.
Return Value
Example
Try out following example:
#!/usr/bin/perl
$int_val = int( 6.23930 );
print"Integer value is $int_val\n";
$int_val = int( -6.23930 );
print"Integer value is $int_val\n";
$int_val = int( 10 / 3 );
print"Integer value is $int_val\n";
It produces following result
Integer value is 6
Integer value is -6
Integer value is 3
|
|

|
|
|