On 11/07/12 16:40, Dirk wrote:
>
> I am new to Perl and I am trying to list all the folders within a given folder and I have the following code.
> I know it is simple but for some reason the program just stops and I am not seeing any error code being returned.
> #!/usr/bin/perl
> #
>
> use warnings;
> use strict;
> use File::Find;
>
> my $path_name;
> $path_name = '/test';
>
> find sub {
> return unless -d;
> print "$File::Find::name\n";
> },$path_name;
>
> exit;
I'm home now and I went as far as making "/test" and a couple of
subdirectories on my personal machine, and ran your code exactly as it
is, superfluous "exit" statement and all. It runs perfectly. So you
have another problem; if you'd reply to some of the posts we'll try to
help you with it.
henry@eris:~/Perl/tryout$ sudo mkdir /test
henry@eris:~/Perl/tryout$ sudo chown henry:henry /test
henry@eris:~/Perl/tryout$ mkdir /test/one
henry@eris:~/Perl/tryout$ mkdir /test/two
henry@eris:~/Perl/tryout$ ./clpm
/test
/test/two
/test/one