use strict; use warnings; use v5.16; my $infile; my $outfile; if ($#ARGV <= 2 || $#ARGV >= 4){ die "Silly you, there are an incorrect amount of args :)\n" } for ( 0 .. $#ARGV / 2 ) { my $switch = shift(@ARGV); my $value = shift(@ARGV); given ($switch) { when ('-f1') { $infile = $value } when ('-f2') { $outfile = $value } } } print "Infile: $infile\n", "Outfile: $outfile";