No such thing as a small change | |
PerlMonks |
Re: How to extract the best match from matrixby kevbot (Vicar) |
on Mar 12, 2017 at 01:24 UTC ( [id://1184305]=note: print w/replies, xml ) | Need Help?? |
Hi jnarayan81,
As pme and choroba mentioned, you will get more/better help if you describe the objective of your nearest function. I did not closely inspect your code, but I took a guess at what you were trying to do and came up with the following example.
I like the Data::Table module for manipulating tabular data, but there are many other ways to load/manipulate your data. If your definition of distance or best match is not euclidean distance then modify the dist subroutine accordingly. UPDATE: Originally the dist sub returned $sum_sq. I changed it to return the correct euclidean distance which is sqrt($sum_sq).
In Section
Seekers of Perl Wisdom
|
|