con
con

Reputation: 6093

how to print command arguments in Getopt::Long getoptions

I am attempting to log behavior in my Perl script. I would like to print all arguments that are passed to Getopt::Long's GetOptions but @ARGV is empty.

I would like something that would automatically print all options and their values that were passed to GetOptions. I have been reading https://perldoc.perl.org/Getopt/Long.html but I can't find anything there.

What I want is very simple, I'm surprised that I can't find anything like this. How can I automatically output all options and their settings for logging purposes?

Upvotes: 2

Views: 1036

Answers (1)

ikegami
ikegami

Reputation: 385657

If you want the value of a variable before it gets changed, you make a copy of the value of the variable before it gets changed.

my @orig_ARGV = @ARGV;

Upvotes: 4

Related Questions