preserve quotes after $0 + @ARGV interpolationby richard.sharpe (Sexton)
|on Dec 13, 2019 at 00:28 UTC||Need Help??|
richard.sharpe has asked for the wisdom of the Perl Monks concerning the following question:
Dear Wells of Perl Wisdom,
when using $0 in my scripts, variable is replaced with whole invocation of the script with command line options and other parameters, but:
as some of parameters or option arguments are quoted with single or double quotes on command-line, that quotes are not present in $0 (because shell removes them before providing ARGV to Perl). Do you have some best practise, how to overcome this issue, having $0 interpolated exactly as put in the shell, also with quotes?
UPDATE: My original question was not complete, actually I was using not just $0, but this:
my $tool_name = basename($0); my $tool_invocation = $tool_name." ".join(" ",@ARGV);