print "'$_'" for split '([&/+-])|\s+', '129-129A & B-131 NORTH AV'; '129' ## Matches the first '-', produces '129' '-' ## and the captured delimiter '129A' ## Match the first space, return '129A' Use of uninit... ## and an undef for the empty capture '' ## and a nullstring? '' ## Match the '&', produces another null string? '&' ## and the captured delimiter '' Use of uninit... ## Match the seecomd space, produce an undef '' ## and a null string? 'B' ## Match the second '-', produce the 'B' '-' ## And the captured delimiter '131' ## Match the 3rd space, produce '131' Use of uninit... ## and undef for the empty capture '' ## and a null string? 'NORTH' ## Match the fourth space, produce 'NORTH' Use of uninit... ## and undef for the empty capture '' ## and a null string for luck? 'AV' ## And the tail of the string. #### print "'$_'" for split '\s*([&/+-])\s*|\s+', '129-129A & B-131 NORTH AV'; '129' ## Match the first '-', produce '129' '-' ## and the captured delimiter '129A' ## Match ' & ', produce '129A' '&' ## and the captured delimiter 'B' ## Match the second '-', produce 'B' '-' ## and the captured delimiter '131' ## Match the first space, produce '131' Use of uninit... ## and undef for the empty delimiter '' ## and a nullstring for luck? 'NORTH' ## Match the second space, produde 'NORTH' Use of uninit... ## and undef for the empty capture '' ## and a nullstring for luck? 'AV' ## And the tail of the string. #### @bits = ( $string =~ m[(.*?)(?:PATTERN)]g, $' ); #### print "'$_'" for '129-129A & B-131 NORTH AV' =~ m[(.*?)(?:\s*([&/+-])\s*|\s+)]g, $'; '129' '-' '129A' '&' 'B' '-' '131' Use of uninitialized value in ... '' 'NORTH' Use of uninitialized value in ... '' 'AV'