I am a newbie in Perl and trying to write a program to do the following: - Compare 2 files (old and new revisions of the same file) - Print out the differences found in the files. - File A will be the reference of the comparison. - The spaces in between are whitespaces.

File 1: Item Name Qty 1 John 23 2 Pete 101 3 Allan 56 4 Jim 72

File 2: Item Name Qty 1 John 24 2 Pete 101 3 Alex 56

Expected output would be: Qty of Item “1” was changed from 23 to 24. Name of Item 3 was changed from Allan to Alex. Item 4 is missing in File2.

Except that this module is not going to give you anything near the output expected in the OP. It does a good job at finding textual differences (just as the diff Unix utility), not at finding finer differences in structured data.

You don't need to. You only need to store file 1 in a hash, and then you read line by line file 2, split it the same way you split the first one to test for the key found in file 2 in the hash built when reading file 1. Assuming the input files are records with just two fields separated by a space, where the first filed is unique and should be the comparison key and the second one the value, something like this:

I showed you in the post # 7 above, you just have to adapt the details (3 fields instead of two). Please try by yourself and then, if you have difficulties, show us the code you tried. Similarly, if there is something you don't understand in the code I posted, feel free to ask.