use DBI; use strict; my $dbh = DBI->connect('dbi:WMI:'); # You need to install DBD::WMI my $sth = $dbh->prepare(<execute(); while (my @row = $sth->fetchrow) { my $item= $row[0]; for (@atts){ if (ref $item->{$_} eq "ARRAY"){ print "$_\t=". join (",", @{$item->{$_}}) . ";\n"; }else{ print "$_\t=". $item->{$_} . ";\n"; } } print "\n"; }