in reply to XP fails, HP-UX OK

It's a shell issue, not a Perl issue. You need different quotes. This works for me in a DOS shell:
perl -MSocket -le "print scalar gethostbyaddr(inet_aton('127.0.0.1'),A +F_INET)"