#! perl -slw use strict; my @w = do{ local @ARGV = 'words.txt'; <> }; chomp @w; my $s = 'couldsomeonerecommendaworkingperlmoduletosplitconcatenatedwords'; my @subset = grep{ $s =~ /$_/ } 'a', 'perl', @w; my $re1 = join '|', sort{ length( $b ) <=> length( $a ) }@subset; my $re2 = "($re1)?" x 20; my @found = $s =~ /^$re2$/; print join '|', @found; my @undefsRemoved = grep defined(), @found; print for @undefsRemoved; #### c:\test>junk Use of uninitialized value $found[12] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[13] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[14] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[15] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[16] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[17] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[18] in join or string at C:\test\junk.pl line 15, <> line 178691. Use of uninitialized value $found[19] in join or string at C:\test\junk.pl line 15, <> line 178691. could|someone|recommend|aw|or|king|perl|module|to|split|concatenated|words|||||||| #### my @undefsRemoved = grep defined(), @found;