use Win32::FileOp qw(Substed); sub findCD { for ('A'..'Z') { return $_.':' if (Substed($_))[1] =~ /^CdRom/ }; return }; print findCD();