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. |