foreach my $arg ( keys %opts ) { log_debug "Argument $arg has value $opts{$arg}"; log_debug "Pre Running total is $getopts_args"; if ( $opts{$arg} eq "1" ) { $getopts_args += 1; } else { $getopts_args+= 2; } log_debug "Post Running total is $getopts_args"; }