Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
print all data matching identical three alphabets from two different filesby mao9856 (Sexton) |
on Nov 15, 2017 at 14:01 UTC ( [id://1203478]=perlquestion: print w/replies, xml ) | Need Help?? |
mao9856 has asked for the wisdom of the Perl Monks concerning the following question: I have two huge files. File1 has one column and File2 has two columns as follows: File1 ABCD12 XYZ13 EFGT45 UVWZ34 TSR78 ........ File2 ID121 ABC14 ID122 EFG87 ID145 XYZ43 ID157 TSR11 ID181 ABC31 ID962 YTS27 ID529 EFG56 ID684 TSR07 ID921 BAMD80 ............. I want to match first column of File1 and starting three alphabets of second column of File2 and print Ids of those are matched.Desired output: ID121 ABC14 ID122 EFG87 ID145 XYZ43 ID157 TSR11 ID181 ABC31 ID529 EFG56 ID684 TSR07 I tried foloowing code:
It know it won't separate matching initial three alphabets, but it will match exact values with 'error: use of unitialized value' until use warnings is blocked. Please help.
Back to
Seekers of Perl Wisdom
|
|