the File::Find docs (and a quick warn tossed into OP's first code) say that $File::Find::name is the 'Complete pathname to the file', and not relative and all the examples given in the The wanted function section indicate the same thing..
Let's recap... yes it is the complete path, but constructed from the original parameter. If you start with ".", your path will look something like "./path/to/file" which, as merlyn said, won't work as the cwd is changed to the directory the current file is in, every time.

So, if you want an absolute path, start out with absolute paths. rel2abs from File::Spec::Functions can do wonders. You don't have to use in it the callback, just apply it to every parameter you pass to find.

use File::Spec::Functions 'rel2abs'; find sub { blah blah } map rel2abs($_), @dirs;
Now you'll get absolute paths.

In reply to Re^3: using file::find::name and file tests by bart
in thread using file::find::name and file tests by richill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.