The bad symbol error is caused because you are attempting to feed
readdir a string and not a directory handle object. You get a directory handle object from a call to
opendir.
File::Find quite literally does what you require - it crawls over a directory tree and tests each file against criteria of your choosing. Your wanted function might look something like:
sub wanted {
return unless -f;
my $mtime = (stat)[9];
return unless $mtime > $limit_time;
print "$mtime\t$File::Find::name\n";
}
where you would have stashed the user input date converted to epoch time in $limit_time.
I mean this with respect, but I believe you are trying to run before you can walk. Do you have programming experience in other languages, or is this your first one? I note you have an unused loop index variable $i, an unused iteration variable $_ and uninitialized $file variable. I would suggest you review http://learn.perl.org/ for some reference resources. In particular, Beginning Perl is widely considered a strong introduction.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.