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

Re: [MacPerl] $0 oddity



At 00.40 12/16/97, Brian L. Matthews wrote:
>#!perl
>$me = $0;
>print "\$0 is '$0'\n";
>print "\$me is '$me'\n";
>$0 =~ s/.*://;
>$me =~ s/.*://;
>print "\$0 is '$0'\n";
>print "\$me is '$me'\n";
>
>If I save this in the file 'name test.pl' on the desktop then run it, I get:
>
>$0 is 'Macintosh HD:Desktop Folder:name test.pl'
>$me is 'Macintosh HD:Desktop Folder:name test.pl'
>$0 is 'name te'
>$me is 'name test.pl'
>
>The third line appears incorrect.

Confirmed here.  It appears that no matter what I name it, the name is
truncated at 7 characters.

If I try something like:

$0 =~ s/^.*?:(.+)$/$1/;

Then I get:

$0 is 'Desktop'

Again, 7 chars.  $0 *is* supposed to be editable, in case anyone was
wondering.  And it works fine under Unix (Solaris 2.5.1, perl5.004_04).  I
cannot check it under 5.004_00.

--
Chris Nandor               pudge@pobox.com           http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==                    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