修改这段 perl 代码, 使可以运行在不同平台?

修改这段 perl 代码, 使可以运行在不同平台?

修改这段 perl 代码, 使可以运行在不同平台?

要使这段代码, 在linux, window, solaris 下运行正常, 应如何修改呢? 

#!/usr/bin/perl -w

use Win32::DriveInfo;

if ( $^O =~ /^(MS)?Win/ )
{

$TotalNumberOfFreeBytes = (Win32::DriveInfo::DriveSpace('c:'))[6];
$TotalNumberOfBytes = (Win32::DriveInfo::DriveSpace('c:'))[5];

print "This is $^O \n";
print "Total Free: $TotalNumberOfFreeBytes\tTotal size: $TotalNumberOfBytes\n";

}
elsif ( $^O =~ /^linux/ )
{
print "This is Linux OS!!!\n";
}

#!/usr/bin/perl -w-- #!/usr/bin/perl -w



if ( $^O =~ /^(MS)?Win/ )
{
require Win32::DriveInfo;

$TotalNumberOfFreeBytes = (Win32::DriveInfo::DriveSpace('c:'))[6];
$TotalNumberOfBytes = (Win32::DriveInfo::DriveSpace('c:'))[5];

print "This is $^O \n";
print "Total Free: $TotalNumberOfFreeBytes\tTotal size: $TotalNumberOfBytes\n";

}
elsif ( $^O =~ /^linux/ )
{
print "This is Linux OS!!!\n";
}