Also, before you do anything else, search http://search.cpan.org for both terms: Medline and PubMed.
In this case, no matter what-in-particular you are doing, you can be certain that you are not the first person to have done it. Always start a project with a careful search of "prior art."