+--------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------+------------------+------+-----+---------+----------------+ | id | int(4) unsigned | | PRI | NULL | auto_increment | | name | varchar(64) | | | | | | abbrev | char(2) | | | | | +--------+------------------+------+-----+---------+----------------+The following code uses Geography::States to populate such a table with the 50+ states of the USA:
use DBI; use Geography::States; my $dbh = DBI->connect( ... ); my $sth = $dbh->prepare('INSERT INTO state(abbrev,name) VALUES(?,?)'); my $usa = Geography::States->new('USA'); $sth->execute(@$_) for $usa->state;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Populate Database Table for States by jeffa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |