in reply to find the latest created file in a directory
This can be done through unix command aswell. Not sure whether this suits your requirements
#!/usr/bin/perl
use strict;
use warnings;
my $latest_file=`find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "`;