in reply to Inserting sequences without duplicates

Your title description is very poor. It's too vague. Besides, the problem is not "a" huge problem, it's "your" huge problem. Please use something a little more descriptive next time.

I'm not exactly sure what you're asking. I assume you know how to query your database, and how to insert those results into another table. That only leaves the uniqueness check. Try using a hash to enforce uniqueness. Something like this:

use strict; my @values = qw(mon10 mon11 mon12 wed15 wed16 wed17 wed18 mon9 mon10 m +on11); @values = sort keys %{({ map { $_ => 1} @values })};

If you don't mind using an explicit temporary hash, you can use this instead:

my %uniq = map { $_ => 1} @values; @values = sort keys %uniq;

Lastly, your database itself might be able to guarantee uniqueness of the rows. I know Oracle has the keyword DISTINCT that eliminates duplicates. You might want to check MySQL for something similar. (You'd also need to expand the ranges in the database too. Oracle can do that, but I'm not sure about MySQL.)