in reply to Re: split paragraph
in thread split paragraph
Your uses of the split and m// built-in functions in this and related posts have a strong flavor of "elephants to catch eels" about them. Consider the following code, which operates on a test string containing embedded newlines because you seem to be using paragrep mode, implying such newlines:
Do you feel you have a fairly good grasp of what is happening in these examples? If not, time and effort invested in gaining such understanding is likely to be generously repaid.c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "$_ = qq{abc\ndef\nghi}; my @ra = split /(.+)/; dd \@ra; ;; @ra = /^(.+)/; dd \@ra; " ["", "abc", "\n", "def", "\n", "ghi"] ["abc"]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: split paragraph
by james28909 (Deacon) on Nov 03, 2014 at 18:34 UTC |