Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: bug of File::Find ?

by iwanthome (Beadle)
on Sep 09, 2005 at 07:32 UTC ( [id://490459]=note: print w/replies, xml ) Need Help??


in reply to bug of File::Find ?

thanks! My true code is like this:

_latest("dire1"); ...do something... _latest("dire2"); ...do something... _latest("dire3"); ...do something... _latest("dire4"); ...do something... sub _latest{ my $file = shift; my @dir; my $saved_time = -1; my $saved_name = ''; sub wanted { if(-f $File::Find::name) { if ((stat($File::Find::name))[9] > $saved_time) { $saved_time = (stat($File::Find::name))[9]; $saved_name = $File::Find::name; } } } @dir = ($file); find(\&wanted, @dir); return $saved_name; }

I don't know how to reset the variable to (-1, '') in this mode. In my opinion,every time I call _latest function,it reset the variable. But test result is not like that. It don't reset. Would you please help me ? thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-03-29 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found