Taking a stab here....

Line 28 appears to be the

        print "$user $TOTAL_SIZE\n";

line, which $TOTAL_SIZE is causing the problem, because you don't test 
whether $TOTAL_SIZE is actually set there can be cases when you print 
without it being set, which is why strict is catching it. One possiblity 
is to set it to '' so,

        $TOTAL_SIZE=''

just after your next line will initialize to an empty string which will 
pass the strict test, but not change your output. Or set it to 0 or some 
such valid value prior to your find.

http://danconia.org


chad kellerman wrote:
> Hey guys,
> 
>    I was working on a disk usage script.  Mainly using stat like DAn had
> in an earlier posting.  Buit when I saw Janek post I thought, "That's
> perfect,  Just what I was doing but about 8 lines less."  I incorporated
> it into my script but the waring message I can't figure out.  I am kinda
> new, but thanks for the help...
> 
> 
> <--snip-->
> 
> use strict;
> use diagnostics;
> $|++;
> 
> use File::Find;
> use vars qw (@users $user $BLOCK_SIZE $TOTAL_SIZE $MB_SIZE);
> 
> @ARGV = ('/home') unless @ARGV; 
> 
> $TOTAL_SIZE = 0;
> $MB_SIZE= 0;
> 
> opendir(DIRECTORY, "@ARGV") || die $!;
> @users = readdir(DIRECTORY);
> closedir(DIRECTORY);
> 
> foreach $user (@users) {
>         next if ($user eq ".") || ($user eq "..") ;
>         find(sub {$TOTAL_SIZE += -s if -f}, "$user");
>         print "$user  $TOTAL_SIZE\n";
>         undef $TOTAL_SIZE;
> }
> 
> <--/snip-->
> 
>   I had to undef $TOTAL_SIZE because it kept adding the users together
> and I could not figure a way to get the du individually.
> 
>   THe error message I am getting says something like this:
> 
> Use of uninitialized value in concatenation (.) or string at
>         /home/ckell/scripts/du.pl line 28 (#1)
> 
> but if the undef is taken out the warning messag is gone but I don't get
> the right results.
> 
> Thanks again,
> 
> chad
> 
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to