in reply to How to get Incremental charecter groups in a string

If I understand what you want then this does the right magic:

use strict; use warnings; my $str="this is abc and bcf and xyz and ijklmn"; my @words = split ' ', $str; my @incWords = grep {$_ eq join '', sort split ''} @words; print "@incWords";

Prints:

is abc bcf xyz ijklmn

DWIM is Perl's answer to Gödel