$target is just the filename you are looking for, "secret.file" in your case.
The difference is that my code is exiting the
wanted function immedeatly when it is not dealing with a directory. Only if there is a directory it is looking wether the target file is in that directory.
Whereas your code looks at each and every file, calculates its' base path (albeit unneccessary, that info is already there in
$File::Find::name). And then it takes that base directory to look for the target file.
This, and this is the biggest slowdown, also means that you are testing the
same directory
number-of-entries-in-the-directory times.
holli
You can lead your users to water, but alas, you cannot drown them.
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.