I think for you this is going to be the best time in your Perl journey to start becoming aware of the strength of Data Structures lent to text processing. Perl, in addition to it's robust regular expressions can as well enable you handle text to your fancy by using a combination of Arrays and Hashes nested within each other to any depth. Start from the following on the Tutorials and I am sure you will never fall short of tricks in front of any text processing task.
in reply to Can a single key have different value assigned to it
References is a good start, if you learn how to reference and dereference then you are well on your way.
David R. Gergen said "We know that second terms have historically been marred by hubris and by scandal." and I am a two y.o. monk today :D, June,12th, 2011...