my $self = { opt => {}, }; getopts('f:v:i:a',$self->{opt}); # -f field -v value -i # what file(s) did user specify. my $files = @ARGV; # only gets fed if arg flags are called via cli before the file list