in reply to Re^2: Capturing Space with Split
in thread Capturing Space with Split

If I understand your reply, you now have a solution to your problem. The "trick" was to gobble up the spaces following the full stop with the \s* in split's regex: split /(?<=\.)\s*/.

The reason for the angle brackets around the text was to demonstrate that there were no hidden spaces - white space can be hard to see. Printing without them is as simple as: print join "\n", @sentences;.

While you are exploring the Monastery I strongly recommend that you wander into the tutorials section and have a good browse there. There is a lot of material that should help someone starting out on their Perl journey.

Oh, and welcome to The Monastery.


DWIM is Perl's answer to Gödel