Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2:[OT] 'perl' is not the 'perl' reported by 'which perl'

by LanX (Saint)
on Aug 21, 2020 at 17:46 UTC ( [id://11120971]=note: print w/replies, xml ) Need Help??


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'

"Interesting" feature...

This link might be useful for the OP, especially the type command and other fixes:

https://unix.stackexchange.com/questions/5609/how-do-i-clear-bashs-cache-of-paths-to-executables#5610

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^3: [OT] 'perl' is not the 'perl' reported by 'which perl' (which vs type References)
by eyepopslikeamosquito (Archbishop) on Aug 21, 2020 at 22:38 UTC
      "... most people use the which command and have never even heard of the type command! ..."

      That's very interesting. I've used quite an array of shells since the '80s (sh, ksh, bash, csh, tcsh, and others). I'm reasonably certain I've used which almost exclusively. I couldn't definitely say I've never heard of type but, had I been asked about it yesterday, I would have had to look it up. I decided to look into this a bit further.

      There appears to be some redundant information (<some-command> is) with type; however, in isolation that doesn't appear to be a problem.

      $ which perl /.../perl $ type perl perl is /.../perl

      I did encounter an issue in this scenario:

      $ ls -l `which perl` -rwxr-xr-x 2 ken None 169225 Jun 23 20:35 /.../perl $ ls -l `type perl` ls: cannot access 'perl': No such file or directory ls: cannot access 'is': No such file or directory -rwxr-xr-x 2 ken None 169225 Jun 23 20:35 /.../perl

      On the other hand, it's particularly useful here:

      $ which perle which: no perle in (...) $ type perle perle is aliased to `perl -Mstrict -Mwarnings -Mautodie=:all -MCarp::A +lways -E'

      So, it looks like both commands have their uses in different situations. I will remember type from now on and use it where needed. Thanks for pointing out this command. [Edit: Actually, it looks like LanX was the first to mention type, so thanks Rolf.]

      [In case anyone was wondering, the /.../perl represents identical pathnames throughout. With "perlbrew", those paths are long and would probably wrap.]

      — Ken

      I've been an SA for like 10 years and never knew that until now. When I think type, I think DOS / windows cat command. Seems to still work in powershell:

      PS C:\Users\Dubs> get-Command type,cat,where,gm,help,get-help CommandType Name Version Source ----------- ---- ------- ------ Alias type -> Get-Content Alias cat -> Get-Content Alias where -> Where-Object Alias gm -> Get-Member Function help Cmdlet Get-Help 3.0.0.0 Microsoft.PowerSh +ell.Core

      Looks like zsh and csh alias to whence -v.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120971]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-11-08 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (65 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.