If the reason you used a spreadsheet was because it was the easiest way for you to edit the data, and your actual question here is "what is the easiest way to pull data from a spreadsheet into Perl", I will suggest my
which can easily extract some columns of a spreadsheet into perl hashrefs (one per row) which you can then use in any algorithm you like, such as suggested by others here.