in reply to How to parse a text file

You may want to consider Nagios::Object::Config