in reply to Re: use package
in thread use package

Or slight improvement:

BEGIN { if( $^O =~ /MSWin32/ ) { require Win32::DriveInfo; import Win32::DriveInfo; } else { require Filesys::DiskFree; import Filesys::DiskFree; } }
But note that you can't make use of the (conditional) compile-time magic such as calling the imported routines without using parens unless it happens that both modules import routines having that same name. This means that the BEGIN block is rarely of much use and can often be dropped.

Further, I suggest that it is often a very good idea to drop the BEGIN block so that you don't accidentally try to make use of some conditional compile-time magic and release a version of your code that won't compile in the "other" case (or just so you save yourself the trouble of finding these bugs when you test the "other" case).

It doesn't appear that either of these modules actually export any symbols. So they should probably have their documentation updated to replace use with require and you can probably drop both of the import lines above (as well as the BEGIN block):

if( $^O =~ /MSWin32/ ) { require Win32::DriveInfo; } else { require Filesys::DiskFree; }
(:

        - tye (but my friends call me "Tye")