http://www.perlmonks.org?node_id=424895

softworkz has asked for the wisdom of the Perl Monks concerning the following question:

Fello Monks, I've started using Perl and wmi and I'm stumped on a little quirk... IF I run the script as it is I will get an unintialized value, so I'm wondering what this hash value is? Thanks for any help!
#!/usr/bin/perl -w use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("MYCOMPUTER"); foreach my $computer (@computers) { my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\ +root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Volum +e", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { #next unless ($objItem->{FreeSpace}); # print "$objItem\n"; print "Free Space on $computer: $objItem->{FreeSpace}\n"; } }