use Getopt::Long; my %opt = (); GetOptions( \%opt, #general file path "path=s", #file name "file=s", ); my $path = $opt{path}; my $file = $opt{file};