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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|