2008年6月25日 星期三

Get host name in perl script.

Situation:

Want to get the host name which the perl script running on.

====

Solution:

The macro `hostname` helps us to get host name.
Note that `hostname` is not 'hostname'. You need to use `, the key which also send ~ on keyboard.

i.e.

$host_name = `hostname`;

沒有留言: