If your amount of data is sort of limited and fits into RAM, the answer by by graff is the way to go. If the data gets bigger, or more complex, or you also start needing more complex sorting/filtering, or you start running into performance problems, you might want to look at using a proper SQL database. For example, PostgreSQL is free, and Perl has excellent support through DBI/DBD::Pg.
Modern databases are super optimized to deal with exactly those kinds of problems. Plus, with PostgreSQL you get the benefit that you can implement server side smarts in Perl (among other programming languages).
perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'