use strict; use Win32API::File qw( getLogicalDrives GetDriveType :DRIVE_ ); for my $root ( getLogicalDrives() ) { my $type= GetDriveType($root); if( DRIVE_FIXED == $type || DRIVE_RAMDISK == $type ) { .... } }