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:
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"]
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.
|