Using regular expressions I match a criteria in a text string, such as:
@duration = $string =~ /\sduration=(.*?)\s/;
The first element in duration contains 1.23, in a string format
When I try to insert $duration[0], into a field of integer type in a database,
I get the Following error:
Error
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 int1.23; # 1
print
On Sep 9, Eduardo Vazquez Rodriguez said:
@duration = $string =~ /\sduration=(.*?)\s/;
The first element in duration contains 1.23, in a string format
When I try to insert $duration[0], into a field of integer type in a database,
I get the Following error:
Error Column duration is of type
Thats exactly my mistake, thanks to everyone
I have a sentence that look like this.
$mbd = DBI-connect(dbi:Pg:dbname=$database, $username, $password)
or die Error opening database: $DBI::errstr \n;
$sth1 = $mbd-prepare
(
INSERT INTO public.table