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

awww... and here I had this nice Perl script:

use warnings; use strict; print `find . -type f -size +500k`

Replies are listed 'Best First'.
Re^3: perl challenge 3
by johnrock47 (Initiate) on Dec 16, 2015 at 00:54 UTC
    #!/usr/bin/perl use File::Find::Rule; use warnings; my $filelist; sub buildFile { open ($filelist, ">", "filelist.txt") || die $!; # File find rule and # Provide specific list of directories to scan my $SubDirs= File::Find::Rule->directory->in('etc', 'dev', 'bin'); + # interpret Size Method and stored the list on @files my @files = File::Find::Rule->size('500')->in($SubDirs); print $filelist map { "$_\n" } @files; return \$filelist; }

    this is what i had can someone correct me

      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)));'

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

      this is what i had can someone correct me

      Does it need correcting?

        i get no output and no errors as well does that mean there is no file larger than 500kbyte

Re^3: perl challenge 3
by stevieb (Canon) on Dec 16, 2015 at 03:34 UTC
    LOL... I just had beer come out my nose. Is that called irony? ;)

      It IS... I just was done cleaning the monastery gates... I'll get a mob.