in reply to Re: print last file updated into directory
in thread print last file updated into directory

readdir is low-level

use Path::Tiny qw/ path /; for my $kid ( path( $dir )->children( qr/\.txt$/ ) ){ print "$kid\n" if -f $kid; }

Replies are listed 'Best First'.
Re^3: print last file updated into directory
by perlron (Pilgrim) on Oct 31, 2014 at 03:55 UTC

    Hello Anonymous Monk,
    By low level , is it that it is not an efficient way to traverse directory structures ?
    was just reading up about Path::Tiny on CPAN. It says it does not try to work in non-Windows and non-linux mode.
    also i see it has quite a few dependencies and wondering if it was pure perl or not, which might be a deciding factor for me ?
    I ran the following command to check the above
    perl -MPath::Tiny -MDynaLoader -E 'say for sort $@DynaLoader::dl_modul +es;'
    which gave me the output
    Cwd File::Glob

    The temporal difficulty with perl is u need to know C well to know the awesome.else u just keep *using* it and writing inefficient code

        thanks for the pointers. makes sense to use the latest version of perl then.
        I use a box which has 5.10.1.
        some of the customers ive worked with have HP UX and solaris , besides there's no telling to which server OS, they will migrate to in the future, in which case i might have to rework the code if i use Path::Tiny.
        Thanks! im learning

        The temporal difficulty with perl is u need to know C well to know the awesome.else u just keep *using* it and writing inefficient code