in reply to how to get cmd prompt output
The simplest is to use backticks, for example:
chomp(my $hostname = `/bin/hostname`); # Note that the chomp is necessary to remove the trailing newline
Another option is to open a piped filehandle, eg:
my $cmd = '/bin/hostname'; open (IN, "$cmd|"); chomp(my $hostname = <IN>);
But neither of the above methods are portable. So as usual, CPAN is your friend. Take a look at Sys::Hostname.
Cheers,
Darren :)
|
|---|