in reply to randomly choosing an alphabetic letter

Sounds like you want:
use Win32; my $next_drive = Win32::GetNextAvailDrive();
If you have drives "A:" through "D:", this returns "E:".
_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^2: randomly choosing an alphabetic letter
by Anonymous Monk on Mar 16, 2005 at 01:10 UTC
    Hello,

    If I would like to choose 4 free drives, and I run the Win32::GetNextAvailDrive() 4 times, it gives me the same drive everytime, not different ones.

    Is there a way I can find out more than one available drive?

    Thanks

      What you would want to do, then, is use each one in a loop, rather than getting them ahead of time. That is, rather than:

      my @drives = ( Win32::GetNextAvailDrive(), Win32::GetNextAvailDrive(), Win32::GetNextAvailDrive(), Win32::GetNextAvailDrive(), ); do_stuff_with(@drives);
      do this:
      for (1..4) { my $drive = Win32::GetNextAvailDrive(); do_stuff_with($drive); }
      Hopefully, do_stuff_with() will net use or something so that the drive becomes unavailable (in use) so the next time through, Win32::GetNextAvailDrive will get a new drive.

Re^2: randomly choosing an alphabetic letter
by Anonymous Monk on Mar 16, 2005 at 01:07 UTC
    Thank you all for your replies