in reply to Is it possible to make reference to substrings and sort them?

Testing the code in OP, and this following version ...

my $text2 = "$text$text"; my $bwt = join('', map{substr($text2, $_-1, 1)} sort{substr($text2,$a) cmp substr($text2,$b)} 0..length($text)-1 );
... reveals the memory usage is well under control for a ~10MB text. The versions with substring reference, on the other hand, blow up completely.

Problem here is that the sort is SLOW. About half a minute for 100k text. Is there not a module for BWT?