for my $key (keys %$characters) { my $character = $characters->{$key}; my $name = $character->{Name}; # about 30 more lines of code to munge the data my @novels = split(/, /, $character->{book}); # line 132 in code my $first_book = $novels[0]; my $first_type = $first_book =~ /^M/ ? 'major' : $first_book =~ /^m/ ? 'mentioned' : undef; # line 134 in code $first_book =~ s/\D//g; # line 135 in code $character->{intro}->{book} = $book_list[$first_book]; # line 136 in code $character->{intro}->{type} = $first_type; $character->{book} = \@novels; # about 30 more lines of code to munge the data }