reimplementation of TOWN in Perl5 (ref: http://jvn.jp/jp/JVN12513975/index.html)