1. foreach $ciudad(@ciudades){
  2. $gw->city("$ciudad", {language => 'es', encoding => 'utf-8'});
  3. my $current = $gw->current;
  4. @info = ($current->{temp_c});
  5. $temperatura = $info[0];
  6. $sth = $dbh->prepare("INSERT INTO temp_ciudad (city, temperatura) VALUES ('$ciudad', $temperatura)");
  7. if(!defined$sth){
  8. die "Cannot prepare statement: $DBI::errstr\n";
  9. }
  10. else{
  11. $sth->execute();
  12. }
  13. }