#! perl -slw
use strict;
use DBI;
my $dbh = DBI->connect('dbi:WMI:');
my $sth = $dbh->prepare(<<WQL);
SELECT DeviceID, Description FROM Win32_SerialPort
WQL
$sth->execute();
while( my @row = $sth->fetchrow ) {
printf "DeviceID: %s Description: %s \n", @row;
}
__END__
C:\test>SerialPorts.pl
DeviceID: COM3 Description: BCM V.92 56K Voicemodem
DeviceID: COM1 Description: Communications Port
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
|