Re: Question on loops and return values
From: Jim Keenan (jkeen_via_google_at_yahoo.com)
Date: 12/04/04
- Next message: Gunnar Hjalmarsson: "Re: print FILE truncating input"
- Previous message: Jim Keenan: "Re: print FILE truncating input"
- In reply to: delfuego: "Question on loops and return values"
- Next in thread: James: "Re: Question on loops and return values"
- Reply: James: "Re: Question on loops and return values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 03 Dec 2004 23:44:56 GMT
delfuego wrote:
> I have a script below that is supposed to read in a list of microsoft
> servers, and output the disk space (current and last), dates
> (beginning and ending), and compute space growth in value and
> percentage; to output file. The question is this: how do I get the
> correct looping going on in my for loops (one is not getting the
> machines, the other is not getting the drive letters; as well as any
> other problems you can point out. The files are listed below the
> scriipt, although I plan to write out two additional columns, growth
> value and growth rate.
> ALL help is appreciated.
> Thanks,
>
> James
Am I correct in suspecting that this is a script that someone else
originally wrote and you have to fix? There's a lot of
less-than-optimal code below (e.g., use of 'our' where 'my' would almost
certainly suffice).
>
> <script beow inline>
>
> use lib "$ENV(HOME)/site/lib"; # occasionally perl whines about not
> in a lib
> no lib ".";
> use warnings;
> use Time::localtime; # needed for tm and using that to get dates
> use Time::tm;
> use Win32API::Resources; # needed for drives and disk space
>
> our @drive = Win32API::Resources::GetDrives();
> our %space = Win32API::Resources::GetDriveSpace("$let:\\");
Here a USENETtiquette problem arises. In order for us to troubleshoot
your code, we need to be on Windows, because the Win32API modules only
work on that OS. If your problem is a Windows-specific problem, then
you should probably post it on a Windows-specific list such as
perl-win32-users@activestate.com. But I'm not reading this on Windows,
so I can't test your code. My hunch is that your problem is *not*
Windows-specific, but is located in how to read directory and file
information.
Wherever you post, you should try to post the smallest possible amount
of code needed to illustrate the problem. Most of the people who read
this list don't have enough time to work through all of it --
particularly if it requires a particular OS. If you try to post the
smallest possible amount you will, in the process, probably locate your
error yourself.
> our $file = (<SD>,"growth.cvs"); # output data file
> our $file2 = (<SD>,"machines.cvs"); # input data file
> our $let = ['A-Z']; # character value for drive letters
[snip balance]
Jim Keenan
- Next message: Gunnar Hjalmarsson: "Re: print FILE truncating input"
- Previous message: Jim Keenan: "Re: print FILE truncating input"
- In reply to: delfuego: "Question on loops and return values"
- Next in thread: James: "Re: Question on loops and return values"
- Reply: James: "Re: Question on loops and return values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|