#define if there (is) are numbers in position 3 and 4 concat to position 3 if (defined ($num1) and defined ($num2)){ $hash{$ita}[3]=$num1$num2; # concat if numbers defined in poition 1 and 2 and store in 3