# return a list consisting of correct division and service
# as a function of $dcr_type and @row
sub division_service {
my ($dcr_type, @row) = ( uc $_[0], @{$_[1]} );
return ('HQ' , undef) if $dcr_type eq 'CONTACT' ;
if ($dcr_type eq 'FAQ') {
return (undef, $row[2] eq 'Service' ? $row[3] : $row[4]);
}
return (undef, $row[4]) if ($dcr_type eq 'LITERATURE') ;
if ($dcr_type eq 'ORGANIZATION') {
my @ret = ($row[2], undef);
$ret[0] = 'HQ' if ($row[0] eq 'Headquarters');
return @ret;
}
}
####
my %division_service =
(
CONTACT => sub { return ('HQ', undef) },
FAQ => sub {
my (@row) = @_;
if ($dcr_type eq 'FAQ') {
return (undef, $row[2] eq 'Service' ? $row[3] : $row[4]);
}
}
}
####
sub division_service {
my ($dcr_type, @row) = ( uc $_[0], @{$_[1]} );
$division_service{$dcr_type}->(@row);
}