I do not see the error. But from your listing, I see you're on Windows. Could you try the following code (without any modifications):
--- #!/usr/bin/perl -w use strict; use File::Find; use Cwd; my $dir = cwd; print "Listing of $dir\n\n"; find ( \&printer, $dir ); sub printer { my $size=(stat($File::Find::name))[7]; print qq{$File::Find::name $size\n}; } --- This gives me something like Listing of /Users/jan/Sites/janeden/public/comp /Users/jan/Sites/janeden/public/comp 272 /Users/jan/Sites/janeden/public/comp/.DS_Store 6148 /Users/jan/Sites/janeden/public/comp/index.html 2089 /Users/jan/Sites/janeden/public/comp/test.txt 0 /Users/jan/Sites/janeden/public/comp/internet 544 /Users/jan/Sites/janeden/public/comp/internet/.DS_Store 6148 /Users/jan/Sites/janeden/public/comp/internet/dienste.html 7128 /Users/jan/Sites/janeden/public/comp/internet/geschichte.html 5741 /Users/jan/Sites/janeden/public/comp/internet/index.html 4036 If you get something else (i.e. some output without the file size), it might be due to differences between Unix and Windows filesystem. ----- Original Message ----- From: Ryan Thomas Sent: 21.04.2004, 13:10 Uhr >I don't get any errors when running the script, it just doesn't print any >file size values. > >A copy of the output is below: > >c:\proggy >c:\proggy/counter.bak >c:\proggy/counter.exe >c:\proggy/counter.pl >c:\proggy/error.txt >c:\proggy/filelist.pl >c:\proggy/filelisting.txt >c:\proggy/linecount.pl >c:\proggy/list.txt >c:\proggy/list2.txt >c:\proggy/lister.pl >c:\proggy/orig.pl > >Any help appreciated. > >Jane > > >----- Original Message ----- >From: "Jan Eden" <[EMAIL PROTECTED]> >To: "Ryan Thomas" <[EMAIL PROTECTED]>; "Perl Lists" <[EMAIL PROTECTED]> >Sent: Wednesday, April 21, 2004 12:59 PM >Subject: Re: Problem with Code > > >Hi Jane, > >----- Original Message ----- >From: Ryan Thomas >Sent: 21.04.2004, 12:18 Uhr > >>Hello All >> >>I have a script below that lists a directory tree structure (thanks for the >base >>code Jan!)and have modified it, unsuccessfully, to add the file size. >> >>What have i done wrong ?? >> >>The output I am looking for is: >> >>c:\anydir\foo.txt 1,102 >> >>code: >> >># Reads a directory tree and parses the results >> >># use strict; >>use File::Find; >>use File::stat; >>use Cwd; > >You should not comment 'use strict;' which will force you to use good >programming style. > >Apart from that, your script works for me. If you want the output mentioned >above, though, you would have to write (printf formatting left out): > >>find ( sub { print qq{$File::Find::name }; >>$size=(stat($File::Find::name))[7]; >>print $size; } > >What error messages do you get? > >- Jan >-- >There's no place like ~/ > > > -- These are my principles and if you don't like them... well, I have others. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>