- For every array element,
- Extract the numeric component of the element.
- If the hash contains a key matching the extracted component,
- If the hash value is empty,
- Print whatever
- Else
- Print whatever
####
for my $id (@array_code) {
my ($num) = $id =~ /(\d+)/ or next;
next if !exists($code_numbers{$num});
my $code = $code_numbers{$num} || 'IN';
print("$id $code\n");
}
####
for my $id (@array_code) {
my ($num) = $id =~ /(\d+)/ or next;
next if !exists($code_numbers{$num});
my $code = $code_numbers{$num};
$code = 'IN' if !length($code);
print("$id $code\n");
}