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

Something like this

my @substrrefs = map { [ \substr( $text, $_ ) , \substr( $text, 0, $_ ) ] } 0 .. (-1+length $text); my $bwt = join ... sort { $$a[0].$$a[1] cmp $$b[0].$$b[1] } @substrrefs;