Typos aside, it is your understanding of the name change which does not tally. It is the name for the O/S which is being changed. Demo:

#!/usr/bin/perl use strict; use warnings; print "I am $0 (@{[join ' ', @ARGV]})\n"; system ("ps $$"); shift; exit unless @ARGV; my @args = ('bar', 'foo.pl', @ARGV); system { '/usr/bin/perl' } @args;

Running this I see:

$ ./foo.pl 1 1 I am ./foo.pl (1 1) PID TTY STAT TIME COMMAND 3717 pts/0 SN+ 0:00 /usr/bin/perl ./foo.pl 1 1 I am foo.pl (1) PID TTY STAT TIME COMMAND 3719 pts/0 SN+ 0:00 bar foo.pl 1

So the name in the O/S has changed to 'bar' but within the script, $0 is still foo.pl since that is the file which perl is executing. Additionally, if you call system ('./foo.pl') the O/S uses the hashbang line to re-exec perl with the script as argument (as in the initial invocation in my run above), so your aliasing there would have no effect even at the O/S level.


In reply to Re: lying about program name by hippo
in thread lying about program name by japl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.