Compare each char in multiple files in perl Tags: Programming CGI Apps Last response: April 11, 2011 8:41 AM in Apps General Discussion Share kri_ari April 11, 2011 3:46:03 AM Hello, I have two files as shown below: File1: MANLGYWLLALFVAtWTDVGLCKKRPKPGGWNTGGSRYPGQGSPGGNRY PPQGGGTWGQPHGGGWGQPHGGGWGQPHGGGWGQPHGGGWGQGGGTHNQ WNKPSKPKTNMKHvAGAAAAGAVVGGLGGYMLGSAMSRPMIHFGNDWED RYYRENMYRYPNQVYYRPVDQYsNQNNFVHDCVNITIKQHTVTTTTKGE NFTETDVKMMERVVEQMCVTQYQKESQAYYDGRRSSAVLFSSPPVILLI SFLIFLIVG File2: MANLGYWLLALFVTMWTDVGLCKKRPKPGGWNTGGSRYPGQGSPGGNRY PPQGGTWGQPHGGGWGQPHGGSWGQPHGGSWGQPHGGGWGQGGGTHNQW NKPSKPKTNLKHVAGAAAAGAVVGGLGGYMLGSAMSRPMIHFGNDWEDR YYRENMYRYPNQVYYRPVDQYSNQNNFVHDCVNITIKQHTVTTTTKGEN FTETDVKMMERVVEQMCVTQYQKESQAYYDGRRSSSTVLFSSPPVILLI SFLIFLIVG Need to compare each character of File1 with File2 and show the matching characters in an output. Could any one help me for this?? Thanks, Krish. More about : compare char multiple files perl Rusting In Peace a b L Programming April 11, 2011 8:41:52 AM So I'm not going to post code here because you'll not learn anything. You need to do the following: 1) Read each file into an array. Perhaps you want to look here 2) Figure out which array is smaller and use that size as the loop size. If they are the same then just use the size. 3) Create a variable to store the matching characters. 4) In a for loop, iterate over both arrays by using the loop count to index into the array. Compare the array elements and if they are the same then add to the variable from step 3. 5) Do what ever you need to do to show the matching characters i.e. show them on screen. m 0 l Can't find your answer ? Ask ! Publish Related resources ZIP multiple files at once, while each has its own password. Forum How can I share multiple folders and multiple file on my home network without having to select each one separately with WinXP Forum More resources !