in reply to Re: [OT] 'perl' is not the 'perl' reported by 'which perl'
in thread [OT] 'perl' is not the 'perl' reported by 'which perl'

You seem to have figured out that the issue here is bash's hashing. You can delete the entire hash with hash -r or just the one path with hash -d perl.

which(1) can be pretty squirrelly and and should be avoided. Bash has the type builtin which will display aliases as well as executable files. To get the documentation on bash builtins, you can use the help builtin. e.g. help type

Canonical names aren't an issue here but realpath is how you get one.

Replies are listed 'Best First'.
Re^3: [OT] 'perl' is not the 'perl' reported by 'which perl'
by syphilis (Archbishop) on Aug 22, 2020 at 11:38 UTC
    which(1) can be pretty squirrelly and and should be avoided.

    Yes - but the main problem with it is simply that its documentation misses out on some crucial detail.
    If that documentation (as provided by man which) mentioned that it didn't always provide what the current documentation (as provided by man which) states that it does, then you could not be critical of it.
    Even better if that documentation recommended using "type" instead.
    But I find it a bit laughable that you have to do type perl in order to get the information that man which falsely claims as being always returned by which perl

    Anyway ... thanks (as always) to all respondents for their contributions.
    And, in future, whenever I see anyone on perlmonks respond to a question with "which perl ?" I'll personally set them straight ;-)

    Cheers,
    Rob