[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] $0 and $]



At 07.29 1998.04.27, Xah Lee wrote:
>Perhaps this has been discussed before.
>
>When I run
>
> print $0;
>
>in MacPerl, I get the full path of the file name. But on both Linux and
>FreeBSD boxes I tried, only the abbreviated path is given, e.g.:
>
> ./scriptName
>
>Could anyone give some reasoning or explaination?

=begin perlop

        $0

                Contains the name of the file containing the Perl script
being executed.  On some operating systems assigning to "$0" modifies the
argument area that the ps(1) program sees.  This is more useful as a way of
indicating the current program state than it is for hiding the program
you're running. (Mnemonic: same as sh and ksh.)

=end perlop

It has been said elsewhere (I forget where) that $0 is not necessarily
reliable to be anything specifically, except that the last part will
contain the file name.  i.e., the paths might be relative or absolute, that
is not in the specs for the variable, and may change from platform to
platform.


>A second question. When I run print $] on my ISP server (FreeBSD), I get
>
>$RCSfile: perl.c,v $$Revision: 1.7.2.2 $$Date: 1998/03/12 19:27:47 $
>Patch level: 36
>
>what does that mean!? I was expecting someting like 5.004.

Looks like your perl build on FreeBSD is borken.  I've never seen anything
like that before.

=begin perlop

        $]

                The version + patchlevel / 1000 of the Perl interpreter.
This variable can be used to determine whether the Perl interpreter
executing a script is in the right range of versions.  (Mnemonic: Is this
version of perl in the right bracket?)  Example:

                    warn "No checksumming!\n" if $] < 3.019;

                See also the documentation of use VERSION and require
VERSION for a convenient way to fail if the Perl interpreter is too old.

=end perlop

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch