Path: utzoo!attcan!uunet!munnari.oz.au!frankland-river!pem From: pem@frankland-river.aaii.oz.au (Paul E. Maisano) Newsgroups: comp.lang.perl Subject: gethostname() in perl Message-ID: <1018@frankland-river.aaii.oz.au> Date: 7 Feb 90 05:13:54 GMT Organization: Australian AI Institute Lines: 25 This is how I find the hostname of the machine I am running on. do 'syscall.pl' || die "syscall.pl: $@\n"; $host = "\0" x 100; # pre-nulled buffer for hostname syscall($SYS_GETHOSTNAME, $host, length($host)); syscall.pl is just of file of system call numbers. I do this because I hate starting up new processes just to find out things like hostname and date etc. It seems a little messy, having to do a direct system call though. Is there another way, or should perl have a gethostname built in function ? I have translated quite a few shell scripts lately, mainly for speed and the hostname function is about the only thing I can recall having trouble implementing directly in perl (excepting the syscall method above). ------------------ Paul E. Maisano Australian Artificial Intelligence Institute 1 Grattan St. Carlton, Vic. 3053, Australia Ph: +613 663-7922 Fax: +613 663-7937 Email: pem@aaii.oz.au