in reply to map <IF> to hash with replacement
Your immediate problem seems to be solved, but based on your question, I am guessing you are doing some sort of XML processing. If you are, I'd suggest you skip re-inventing any wheels and consider the resources already available.
The main XML parsing module on CPAN is XML::Parser. A handier interface to it is provided by XML::Simple.
PerlMonks has a tutorial on XML::Parser, although it's almost ten years old.
Edit: As I wrote this, in the back of my mind I was hoping that another monk would help out in case my recommendations were out of date. Your Mother came through - thanks!