qball has asked for the wisdom of the Perl Monks concerning the following question:
I want to first print all values that aren't in table COMPANY. Then I want to print all keys that match up to values that are in the table based on the hash key values.foreach $comp_id (keys %hash){ $sql = <<END_SQL; select comp_name from company where comp_name = '$hash{$comp_id}' END_SQL $query = &execsql($sql); if(!$data[0]){ print "insert '$hash{$comp_id}' in table COMPANY\n"; } while (@data = $query->fetchrow) { if($data[0]){ print "insert $comp_id in table TYPES for $data[0]\n"; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Hash Value Part 2
by arturo (Vicar) on Apr 07, 2001 at 01:32 UTC | |
Re: Hash Value Part 2
by ton (Friar) on Apr 07, 2001 at 02:52 UTC | |
Re: Hash Value Part 2
by qball (Beadle) on Apr 07, 2001 at 01:45 UTC |