Compare each char in multiple files in perl Tags: Programming CGI Apps Last response: April 11, 2011 8:41 AM in Applications 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. Can't find your answer ? Ask ! Publish Related resources Perl roguelike coming along Forum newsreader recommendations Forum A small IF platform survey Forum Article about CRPGs at Escapist Magazine Forum Sangband beta 18 available. Forum Wiping single/ multiple Hard drives Forum Complex weaponry Forum Hardest Variant? Forum What language to learn? Forum Best add-ons Forum Multiple Monitor Game Configuration Forum Raptor vs. Raid 0 (4 drives) Forum Intel's Core 2 Quadro Kentsfield: Four Cores on a Rampage Forum Low Quad Core Optimization For Recent Gaming Forum CPU power vs programming... Forum Apple iMac Display Problems Reported Forum What is the difference between Extended and normal version of a software? Forum Identifying copied files Forum Program to delete unnecessary files Forum Software to edit ISO files like a zip file Forum More resources Read discussions in other Applications categories Graphics Internet Applications Multimedia Office Security CAD Distributed Computing Drivers Enterprise Software Firmware Programming Photoshop Skype Wordpress !