Perlers, I'm working on a small script that checks the free space on local fixed drives on my system. Since there other drive types (i.e. floppy, CD-ROM, network maps) I want to exclude those. I decided to use a hash but the script still displays all of the drives on my system. If I just use simple 'next' statements, it works fine. I've placed the block inside the original foreach and even tried wrapping it around the print statements to no avail. What gives?
# how much pizza has been eaten? use warnings; use strict; use Win32::OLE('in'); my $megaBytes = "1048576"; my $gigaBytes = "1073741824"; my %ignoreDriveTypes = ( 'floppy' => '2', 'network' => '4', 'cdROM' => '5', ); my $sobj = Win32::OLE->GetObject('winmgmts:{impersonationLevel=impersonate}') or die "Unable to create server object: " . Win32::OLE->LastError() . "\n"; foreach my $process (in $sobj->InstancesOf("Win32_LogicalDisk")) { foreach my $type ( keys %ignoreDriveTypes ) { next if ( $process->{DriveType} == $ignoreDriveTypes{$type} ); } #next if ( $process->{DriveType} == 4 ); #next if ( $process->{DriveType} == 5 ); print "\n+--+\nDevice Name: \t\t" . $process->{Name} . "\n"; print "DriveType: \t\t" . $process->{DriveType} . "\n"; printf "Size: \t\t\t%4.2f GB\n", $process->{Size} / $gigaBytes; printf "FreeSpace: \t\t%4.2f GB\n", $process->{FreeSpace} / $gigaBytes; } TIA, ry -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>