Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

#!/usr/bin/perl use Date::Format; our $cur_date = time2str("%d",time); print "Current Date : $cur_date\n"; my $path = '/home/cont'; @listfiles = `find "$path" -type f -mtime -7 -print`; print @listfiles."\n";
I have tried to list the files but no luck. It is not copied to an array. How can I copy all the files with the modifition times for last 7 days.

Replies are listed 'Best First'.
Re: list files
by jwkrahn (Abbot) on Dec 16, 2009 at 06:29 UTC
    print @listfiles."\n";

    You are using the concatenation operator which forces its operands into scalar context, and an array in scalar context returns the number of elements in the array, not the contents of those elements.    Try printing the array in list context instead:

    print @listfiles, "\n";