in reply to 2 Questions on File::Find
First answer:
I think that what you are trying to do is:
find( sub { $dir = $File::Find::name if ( /hello\.txt/ ) }, '/tmp/test +' );
defining an anonymous sub as callback. I don't understand how can your code "work" for you are using strict and $dir is not defined anywhere.
Second answer:
File::Find::find does not work so. As per documentation, the return value of the callback function is ignored by find. The correct way to do it is that of your first example.
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
|
|---|