in reply to editting hosts file

Is there a clean interface via Perl to /etc/hosts?

gethostent