foreach $ciudad(@ciudades){ $gw->city("$ciudad", {language => 'es', encoding => 'utf-8'}); my $current = $gw->current; @info = ($current->{temp_c}); $temperatura = $info[0]; $sth = $dbh->prepare("INSERT INTO temp_ciudad (city, temperatura) VALUES ('$ciudad', $temperatura)"); if(!defined$sth){ die "Cannot prepare statement: $DBI::errstr\n"; } else{ $sth->execute(); } }