$ cat a.pl
#!/usr/bin/perl
use feature qw( say );
say $0;
$ pwd
/home/ikegami
$ perl a.pl foo
a.pl
$ perl ./a.pl foo
./a.pl
$ perl /home/ikegami/a.pl foo
/home/ikegami/a.pl
$ perl "$HOME/a.pl" foo
/home/ikegami/a.pl
$ a.pl foo
./a.pl
$ ./a.pl foo
./a.pl
$ /home/ikegami/a.pl foo
/home/ikegami/a.pl
$ "$HOME/a.pl" foo
/home/ikegami/a.pl
####
use String::ShellQuote qw( shell_quote );
my $cmd = shell_quote($0, @ARGV);
##
##
use String::ShellQuote qw( shell_quote );
my $cmd = shell_quote($^X, "--", $0, @ARGV);