Eduardo Vazquez Rodriguez <[EMAIL PROTECTED]> wrote:
: How can I convert my string "1.23" into a integer value,
: so I can insert correctly in the database
The answer is a question. How do you want to convert
1.23 into an integer?
use POSIX qw( ceil floor );
print int 1.23; # 1
print ceil 1.23; # 2
print floor 1.23; # 1
print round( 1.23 ); # 1
print 100 * 1.23; # 123
sub round {
# round to nearest integer
my $float = shift;
return $float % floor $float > 1 ? ceil $float : floor $float;
}
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>