$str="this is abc and bcf and xyz and ijklmn"; (@word) = split ' ', $str; for $org (@word) { $inc = join '', sort split '', $org; print "Group of incremental characters:\t$org\n" if ($inc eq $org); }