There are a few problems here.
- Your foreach loop uses $DISK to store each item, then you go and access $Disk. Perl is case-sensitive, either change the first to $Disk or change the rest to $DISK
-
$Disk->{Size} and $Disk->{FreeSpace} seem to be returning undef, so those 2 columns of your output are blank as well.
- You have 4 format fields in your DISK_FORMAT and 5 variables below it. Not sure if you want another field, or if you want to get rid of a variable there.
- Again, in your FormatNumber sub, you work on $Number, but return $NUMBER.
Other than those 3, the code seems to work fine, although there are other small problems such as formatting, and the use of
local that could use fixing up.
Update: Spotted the error in FormatNumber