Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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


Comment on Re: Remote Drive Info
Select or Download Code
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!

      ronald

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://349460]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (14)
As of 2015-07-06 11:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (73 votes), past polls