Your code also looks for 'complexe' (no extension) when asked to look for 'complexe' (because of the empty string you pass to map) so you have the same 'bug'. Your code doesn't output 'complexe' because '-x' compares the extension (again) for you.

You also suffer from a bug (or perhaps interface contract dispute) in (at least some versions of) File::Spec in that '.' is not returned from File::Spec->path() even though it is unconditionally searched first even if it isn't present in $ENV{PATH}. Perhaps File::Spec->path() is meant to (as documented) only return what is set in $ENV{PATH} rather than returning what would be more useful, the list of directories that would be searched when a command is entered. I'd rather this bug be fixed by updating File::Spec's implementation and documentation, however.

- tye        


In reply to Re^3: `which` (for Windows) in pure perl (bugs) by tye
in thread `which` (for Windows) in pure perl by bart

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.