Jul 10, 2013, 10:16 AM
Post #3 of 9
The very first thing you should do is learn to use CPAN then search for modules which you may be able to use. Be sure to check out the string processing functions as well as the BIO section. You might get lucky and find that someone else has already done your project! Even if you do not find a single piece of useful code, the effort is rarely wasted. You will learn subtleties such as name conventions and things to avoid, not to mention a good start for your next project. If you do not understand the documentation for a module, ask for help here.
Re: [SteelyDan] Creating a Sequence 'Array'
[In reply to]
You did not say how you get your original string. It probably comes in a file. Does it have any header info? If so, how can you tell where the data starts (and ends)? Is it broken into records? Are you sure that the length of the data portion is an exact multiple of twenty-one? What should you do if it is not? What if the data contains unexpected characters?
You plan to compute and store all twenty-one circular permutations of each substring. It might be better to compute each permutation as you need it. You probably should not decide until you have some idea how much time and memory each approach will require.
I do not understand "... and so on." I assume that 1 through 21 refer to the permutations of the first substring. Does 22 refer to the first permutation of the second substring?
There are two ways to manipulate strings in perl. You can work on them directly with the functions index, length, substr, pack, and unpack and with regular expressions. Or, you can split them into an array of characters and then use push, pop, shift, unshift, and splice. In your case, I recommend the first.