Whoops, nevermind, I just realized what you meant this line to do: > elsif ( $test =~ s/[rR]//g) { $new = C("$test"); } I think Shawn's answer of starting the program with a 'foreach' loop that strips options out of @ARGV and sets corresponding flags is probably the best, and most flexible solution to this problem.