in reply to Re^2: how to assign 'system' to a value, and eval it.
in thread SOLVED:how to assign 'system' to a value, and eval it.

Consider using Getopt::Long instead of hand-rolling your option parsing. Getopt::Long can also set up your callbacks but will handle many more features:

use Getopt::Long qw(:config pass_through); my $run; GetOptions( 'x|run-using-system' => sub { $run = \&system }, 'X|run-using-mysystem' => sub { $run = \&mysystem }, ); $run->(@ARGV);

Replies are listed 'Best First'.
Re^4: how to assign 'system' to a value, and eval it.
by vincentaxhe (Scribe) on Jun 10, 2024 at 01:41 UTC
    I'm writing rsync wrapper script,It means to collect and separate rsync args from filenames, anyway thanks for your advice, 'passthrough' is good.