http://www.perlmonks.org?node_id=782142


in reply to Re^2: Pathfinder - find duplicate (shadowed) programs in your PATH
in thread Pathfinder - find duplicate (shadowed) programs in your PATH

Does grep { ! -d "$dir/$_ && -x _ } not work?
Yes, I believe your Other Way To Do It is functionally equivalent to my code (assuming you close the quotes, of course). Your version has fewer keystrokes, and it may even run faster since it has one fewer grep, if one were so inclined to benchmark it. It produced the same results as my code.
  • Comment on Re^3: Pathfinder - find duplicate (shadowed) programs in your PATH

Replies are listed 'Best First'.
Re^4: Pathfinder - find duplicate (shadowed) programs in your PATH
by parv (Priest) on Jul 22, 2009 at 12:02 UTC

    Ah, thanks for catching the missing quote. During editing, I lost it.

    The point was neither reduction in typing nor increase in raw speed, though. To me personally, the extra grep was gratuitous; more importantly, cached results of one file test were not being used for another file test.

    (Perhaps I should have put something along the lines of "unless your effort was one off or were just testing" somewhere in my previous reply.)