I have this perl script and it takes in arguments using the getoption package.
Is th开发者_如何学Goere an easy way to document what was the exact command the user used to execute?
I would like to document into a log file.
Gordon
Use $0
and @ARGV
together:
my $full_command = join(' ', $0, @ARGV);
or you can simply
my $full;
BEGIN { $full = "$0 @ARGV" }
#
print "log: $full\n";
form the perlvar
$LIST_SEPARATOR
$"
When an array or an array slice is interpolated into a double-quoted string or a similar context such as /.../ , its elements are separated by this value. Default is a space. For example, this:
print "The array is: @array\n";
is equivalent to this:
print "The array is: " . join($", @array) . "\n";
精彩评论