in reply to Re^4: Split a string at a given line number
in thread Split a string at a given line number
Tested with AS 5.8.9, should work (but untested) with pre-5.8:
>perl -wMstrict -le "my $s = qq{line 1\nline 2\nline 3\nline 4\n}; my $l = 2; my @sra = $s =~ m{ (\A (?: [^\n]* \n){$l}) (.*) }xms; use Data::Dumper; print Dumper \@sra; " $VAR1 = [ 'line 1 line 2 ', 'line 3 line 4 ' ];
|
|---|