for my $link (@a) { $dbh->do("INSERT INTO htmllinks VALUES ('$base',' $link')"); } #### +---------------------------------------------------------+ | webpage | htmllinks | +---------------------------------------------------------+ |http://myurl.com | http://myurl.com/link_one/ | |http://myurl.com | http://myurl.com/link_two/ | +---------------------------------------------------------+