in reply to Parsing multiline string line by line
but probably you need to work on it if you need to process empty lines as well.use strict; use warnings; my $str = "First line\nsecond line\netc. lines here"; while($str =~ /([^\n]+)\n?/g){ print "LINE: $1\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing multiline string line by line
by metaperl (Curate) on Feb 19, 2009 at 14:47 UTC | |
by perreal (Monk) on Feb 19, 2009 at 15:09 UTC | |
|
Re^2: Parsing multiline string line by line
by flamey (Scribe) on Feb 19, 2009 at 14:21 UTC | |
by mikelieman (Friar) on Feb 19, 2009 at 14:42 UTC | |
by perreal (Monk) on Feb 19, 2009 at 15:16 UTC |