You pointed to a
k-Means Clustering tutorial by Kardi Teknomo, which includes a demo program in VB. I had promised you that I'd try to port the algorithm to Perl... I found the VB program so illustrative, that I ported the whole program to Perl/Tk, even though I've never actually used Tk for anything real. As a result, it took me a few days.
You can find the demo program in CUFP, in k-Means Clustering demo program with Tk.