in reply to Re: Different meanings of $0 under the same operating system
in thread Different meanings of $0 under the same operating system

...all of which can be summarised as: $0 represents the path by which *NIX locates the script
Except of course when it doesn't.
$ perl < knowthyself My name is -...

Replies are listed 'Best First'.
Re^3: Different meanings of $0 under the same operating system
by Bloodnok (Vicar) on Nov 04, 2009 at 01:52 UTC
    Ahh, but it is ... since, when used as a file name, '-' is an alternative id for stdin - witness most of the *NIX filter commands e.g. sort, join et al

    A user level that continues to overstate my experience :-))
      That many *NIX filter commands take '-' to be STDIN is an application convention. It's not something either the OS, or any of the standard libraries treat as special. In perl < foo, - isn't passed as an argument to any function of the exec family. It's not UNIX that is 'locating' the script.

      I don't see your point. Are you saying opening '-' should give me the script, or are you saying that opening '-e' would normally give me the command line arguments?

      >perl -le"print $0" -e >perl -lE"print $0" -e