Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: Please advice

by kennethk (Abbot)
on Aug 11, 2011 at 16:05 UTC ( [id://919904]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Please advice
in thread Please advice

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://919904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found