in reply to Re^3: perl challenge 3
in thread Reaped: perl challenge 3

Query Method in( @directories )
so ->in($SubDirs); has to be an array, and not a scalar string.

Hint: qw(/etc /dev /bin) creates a nice array with those directories.

Please notice the slash at the beginning. A directory always has that...



perl -MFile::Find::Rule -e 'print join("\n", File::Find::Rule->directory->in(qw(/etc /dev /bin)));'

Replies are listed 'Best First'.
Re^5: perl challenge 3
by johnrock47 (Initiate) on Dec 16, 2015 at 01:48 UTC

    do i need to replace my line with your line or just add the slashes

      you need to replace
       my $SubDirs= File::Find::Rule->directory->in('etc', 'dev', 'bin');
      with

      my @startDirs = qw(/etc /dev /bin); my @SubDirs= File::Find::Rule->directory->in( @startDirs );

      and then use @SubDirs in the next statement... this might work (untested) it could also ve @startDirs

        What is in /etc /dev and /bin ? I can't imagine they have both files and subdirs ... you can probably just skip that part and give these original dirs to the next find call