If I understand you correctly, you're storing data in complex structures that you find hard to manipulate. The reason you're asking about NoSQL type of stuff is that you want an easy way to store and manipulate your data.
It's then time to roll up the sleeves and learn Object Oriented Perl.
Creating Perl objects is a good way to handle your complex data structure, and it's really not all that hard to learn. I normally write classes on the fly and just declare them at the end of my program.
This is the data structure you had in your initial post as a Company class:
package Company;
sub new {
my $class = shift;
my $name = shift;
my $location = shift;
my $self = {};
bless $self, $class;
$self->Name($name);
$self->Location($location);
return $self;
}
sub Name {
my $self = shift;
my $name = shift;
if ( defined $name ) {
$self->{NAME} = $name;
}
return $self->{NAME};
}
sub Location {
my $self = shift;
my $location = shift;
if ( defined $location ) {
$self->{LOCATION} = $location;
}
return $self->{$LOCATION};
}
That's all there is to it. Now I can easily create and manipulate my companies without worrying about manipulating hashes of hashes, or trying to remember exactly how I structured my data:
# Read in all of the companies from $company_file into @company_list
open my $company_fh, "<", $company_file;
my @company_list;
while ( my $line = <$company_fh> ) {
chomp $line;
my ($name, $location) = split /:/, $line;
my $company = Company->new( $name, $location );
push @company_list, $company;
}
close $company_fh;
Later on, I can manipulate my companies like this:
#Print out all Chinese Companies
for my $company ( @company_list ) {
if ( $company->Location eq "China" ) {
say $company->Name . " is located in China.";
}
}