Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Remote Drive Info

by Paladin (Priest)
on Apr 30, 2004 at 17:16 UTC ( #349460=note: print w/replies, xml ) Need Help??

in reply to Remote Drive Info

There are a few problems here.
  1. 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
  2. $Disk->{Size} and $Disk->{FreeSpace} seem to be returning undef, so those 2 columns of your output are blank as well.
  3. 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.
  4. 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

Replies are listed 'Best First'.
Re: Re: Remote Drive Info
by Util (Priest) on Apr 30, 2004 at 17:49 UTC
    ++Paladin. I would just add:
    • By adding either #!perl -w or use warnings 'all'; to the top of your program, you would receive diagnostic messages that would have helped you find the problem; i.e.
      Name "main::NUMBER" used only once: possible typo at line 47
      Name "main::DISK"   used only once: possible typo at line 31
      Don't forget also use strict!


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://349460]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2018-05-23 15:46 GMT
Find Nodes?
    Voting Booth?