foreach $key (keys %fileindex) { my $val = encode("iso-8859-7", $fileindex{$key}); $sth = $dbh->prepare ('INSERT INTO products4 (p_url,p_desc) VALUES(?,?)'); $sth->execute ($key,$val); $sth->finish ();