in reply to Re: Perl List files in directory
in thread Perl List files in directory

1st recommandation should be File::Find. In your case

Are you sure about that? Because that doesn't have /opt/tmp or @files

My first recommendation is always File::Find::Rule

use File::Find::Rule qw/ rule find /; my @files = find( file => maxdepth => 1, ascii => in => '/opt/tmp' );

Replies are listed 'Best First'.
Re^3: Perl List files in directory (find/rule)
by bigj (Monk) on Apr 22, 2014 at 11:32 UTC
    O.K., you'd have to change '.' from my snippet to '/opt' or '/opt/tmp' or $dir to work it on other than current dir. Whether you use File::Find or File::Find::Rule is more a matter of taste. The maintainer of the module describes it as a is a friendlier interface to File::Find :-).

    Greetings,
    Janek Schleicher

      O.K., you'd have to change ...

      But where is the @files? :)

      Whether you use File::Find or File::Find::Rule is more a matter of taste.

      :) Hmm, @files? There is nothing like @files in File::Find docs ... OTOH File::Find::Rules shows a @files

      Its more than a matter of taste, File::Find::Rules is much much more memorable ... and friendly to noobs

      File::Find::Rules is like cake (sweet), where File::Find is like raw flour