On Tue, Mar 3, 2009 at 14:28, Lauri Nikkinen <lauri.nikki...@iki.fi> wrote:
snip
> my $dir = $ARGV[0];
snip
> find( sub { -f and ( $size += -s _ ) }, $dir );
> ~ > perl Print_directory_sizes.pl
> invalid top directory at /System/Library/Perl/5.8.8/File/Find.pm line 592.
>
> So, something is wrong here also...
snip

What is wrong is you are specifying that the find function should look
in $dir, which set by $ARGV[0], which is the first commandline
argument (which you haven't set).  The undef value is not a valid
directory name so Perl is rightly complaining.  Try

perl Print_directory_sizes.pl .

or changing the line where you assign to $dir to read something like this:

my $dir = defined $ARGV[0] ? $ARGV[0] : '.';

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to