in reply to Re^4: clustering pairs
in thread clustering pairs
Sadly there are a few issues with that code. Some are transcription errors, some are coding convention related, some are bugs and one is at odds with a PerlMonks' convention.
First the PerlMonks' convention: runnable stand alone code. By removing the file handling and using DATA instead it's easy to make your code stand alone.
Coding conventions: always use strictures (use strict; use warnings;). Use a consistent indentation style (Perl tends toward K&R with 4 character indents). Use the three parameter version of open and test for errors (open ... or die "... $!\n" by convention). Don't slurp (my @arr = <DATA>;). Use blank lines to break your code up into "paragraphs". Comment tricky stuff (your use of $flag and the appended 1 for example).
Bugs: it doesn't work! I get two one row clusters then everything else in one cluster. With strictures on there are "Use of uninitialized value" warnings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: clustering pairs
by sugar (Beadle) on Dec 03, 2008 at 02:56 UTC |