On Friday, Nov 14, 2003, at 10:48 US/Pacific, [EMAIL PROTECTED] wrote:


Thanks that help. but I notice there is a newline included in the variable
when using the ($name)=`uname -n`;
[..]

See the Sys::Hostname module...


http://danconia.org

I of course like wiggins recommendation since the more traditional code solution is

        use Sys::Hostname;
        my  $host = hostname;
        
        print "we be $host \n";

which will port over the various flavors and not lock
you into needing to have 'uname' in your path.

The other advantage is that you do not have to worry
about the 'newline' since the Sys::Hostname module is your friend.

My pet favorite way to deal with getting information in
from external commands of course is

        open(CMD, "$cmd 2>&1 |") or die "cmd $cmd failed with: $1";
        while(<CMD>)
        {
                # parse the command stuff here
        }
        close(CMD);

Which is useful when the input you are expecting from $cmd is
longer than a simple 'quicky'.


ciao drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to