in reply to Getting net addy on localhost?
localhost should always resolve to 127.0.0.1. If it doesn't you have misconfigured computer.
If you are on UNIX-like system you can parse output of ifconfig to get your real IP.
In Section
Seekers of Perl Wisdom