use List::Util qw(max); my @lines = split /\n/, $str; my $prefix = join "\n", @lines[0..@lines-16]; my $postfix = join "\n", @lines[max(0, @lines-15)..$#lines];
(Update: fixed offby1 error)
In reply to Re: Split a variable at a Given Line-Number
by moritz
in thread Split a variable at a Given Line-Number
by danj35
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |