This is regarding a small project, where i will have store 20 alpahbets in pairs(characters in the form of array in pasirs, like AA AB AC..like wise), and compare the input sequence like ABCDG.... with the pairs.

To explain in detail:if the ssequence is ABCDG, then first two characters will be compared with the existing pairs( 20 characters in the form of array in pairs, like AA AB AC..like wise) if avaiable notify with count, i.e AB compare with all pairs like AA ,AB .. then BC compare with AA, AB .....and so on..

To put it more simple..i need to hard cord 20 alphabets(A,B,C,D,...in combinations like AA,AB, it comes around 300+ combinations) , then compare the input sequence ABCDA...with these hard cored pairs..but the inpout sequence will be compared like 1-2, 2-3, 3-4(AB,BC,CD)....

Am not able to understand the below code properly...sorry am just a beginer(am actually new to programming)...i trying to analyse your code and work it out..meanwhile if i have confused you with equirement here in more detail.

My script counts all 400 possible pairs of the 20 letters A through T. It examines every pair in the sequence. If it contains a character not in the set, it goes to the next pair. Otherwise, it uses the pair as a key into the counts hash and increments the value. When it is finished counting, it prints the contents of the hash. The strange line at the end is a test sequence which I made by random banging on the keyboard.

Run the script as is. Check the results by hand.

You can try it with a real sequence by changing the regular expression to contain the correct 20 characters and by replacing my sequence with a real one. If that much meets your requirements, we can discuss user interface requirements and the elimination of unwanted pairs.

It seems you do not want most but not all of the 400 pairs. It probably is easier to count all the pairs and ignore the few you do not need than it would be to count only the required ones. Good Luck, Bill

Thanks Bill. The script worked perfectly. Is it possible to run the script for the input data which is quite large (approx. 1500 characters), also for about quite a large number of entries and then save the output corresponding to each entry in a file?

Your 1500 character file is not really very large, it should not be a problem. The attached script is the same as the previous except that it reads from a file and writes to a file (both specified on the command line).

Code

perl selvankj.pl mysequence.dat mypaircount.dat

I changed the output format slightly. It is not necessary or even desirable to line up the columns in a file. The script reports, on the screen, the total number of pairs counted. This is to assure you that the script did complete without errors. Good Luck, Bill