I have data files in text format which have several rows. Now there are certain rows that have wrong data which I need to update with those that have the correct data. For example,
Col1 Col2 Col3 Col4 .......
A1?% A foo fooo .......
B€(2 B .................
C&6 Z .................
A?04 Y .................
B++3 Q .................
C!5 C .................
D*9 D .................
The actual data is different but this is a simplified version of it. As you can see there are certain Col1 where A1 is A but A4 is Y and so on. The rest of the columns Col3, Col4 ... depend on Col2. So, I need to check if Col2 is A when there is an A in Col1 (A1, A2, A3 etc). If not I have to update Col2, Col3 .... based on the row where it is A.
How may this be accomplished in Perl. I know this kind of operations can be done in an database with an update statement but I don't have that luxury here and have to do it programatically.
Edit: The files are tab delimited and the data are strings that can contain any alphanumeric or ascii character.