First, since you are talking about performance characteristics, appropriate optimization depends on real use cases; this means we'd need not only your code, but some characteristic input. Then, you should use a profiler (like Devel::NYTProf) in order to accurately identify what's taking all your time.
On casual examination of your code, I note that you call study multiple times (once for every value of @string) on your %seq values. I haven't used study myself, but it seems like moving that outside your loop would buy you some time, e.g.
study for values %seq;
foreach my $string (@string) { ...
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.