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"; #### is abc bcf xyz ijklmn