http://www.perlmonks.org?node_id=400275


in reply to Finding oldest file in directory

my $cmd = $^O =~ /Win32/ ? 'dir /od /b' : 'ls -1rt'; my( $file ) = qx( $cmd ); chomp $file;