I have a string like:
za b c
x y
x z
ya b c
x y
x z
Now if I split as:
my @lines = split /\n([a-z])/, $input;
my @sorted_lines = sort @lines;
The input line is split into three parts as:
za b c
x y
x z
y
a b c
x y
x z
Is there a way to split based on newline+somecharacter, but retain that character to the next token ? I mean I want the output to have only two tokens as: 1) za ... and 2) ya ....
[a-z]?