my @current_version = split_version($old_version); my @commands = map { if( $updated[$_]) { # did we update this field? my $current_version = join '.', @current_version; $current_version[$_] = $new_version[$_]; update_aht_command( # if so, generate a command (KEYWORDS)[$_], $new_version[$_], "#DBVersion=$current_version", ) } else { # otherwise put nothing in the command list. (); } } VERSION_ELEMENTS; #### my @current_version = split_version($old_version); my @commands; foreach my $part ( VERSION_ELEMENTS ) { if( $updated[$part]) { # did we update this field? my $current_version = join '.', @current_version; $current_version[$part] = $new_version[$part]; push @commands, update_aht_command( (KEYWORDS)[$part], $new_version[$part], "#DBVersion=$current_version", ) } }