in reply to Re: Capturing Space with Split
in thread Capturing Space with Split
Your code print '>', join ("<\n>", @sentences), '<'; does exactly what I want except for the > < I would like the data without the space to left after the first line.use warnings; use strict; while (<DATA>) { chomp; my @sentences = split /(?<=\.)\s*/; #print '>', join ("<\n>", @sentences), '<'; foreach(@sentences){ print "$_\n"; } } __DATA__ Hello world. Hello Bretheren. Goodbye spaces. All I really want are se +ntences. [download] Which prints: Hello world. Hello Bretheren. Goodbye spaces. All I really want are sentences. Your code >Hello world.< >Hello Bretheren.< >Goodbye spaces.< >All I really want are sentences.< I would like: Hello world. Hello Bretheren. Goodbye spaces. All I really want are sentences.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Capturing Space with Split
by GrandFather (Saint) on Mar 13, 2006 at 21:51 UTC |