#!/usr/bin/perl -w use strict; use Data::Dumper; use File::Find; # Global array for the accumulated files... my @files = (); # Any directory will suffice here... my $file_dir_root = "/var/log"; #------------------------------------------------ sub findNewerThan { #------------------------------------------------ # my $days_ago = shift; my $filename = $File::Find::name; return unless -f $filename; # Now stat the file to compare its modification time # with the days_ago parameter... push( @files, $filename ); } #------------------------------------------------ sub days($) { #------------------------------------------------ my $days = shift; my $oneday = 60 * 60 * 24; return $days * $oneday; } #------------------------------------------------ # MAIN #------------------------------------------------ my $func = \&findNewerThan; #find($func->(days(5)), ($file_dir_root) ); find( $func, ($file_dir_root) ); print Dumper( \@files );