in reply to Re^2: Split a variable at a Given Line-Number
in thread Split a variable at a Given Line-Number

Hole-in-one! :)

print ( (split /(\n)/,$txt )[-32..-1] )

Cheers Rolf

Update: added parens for print...

Replies are listed 'Best First'.
Re^4: Split a variable at a Given Line-Number
by moritz (Cardinal) on May 18, 2010 at 13:39 UTC
    To quote the original problem:
    variable into two separate variables where one variable contains the last 15 lines of text (including any newline characters) and the other contains the rest.

    (emphasis by me). Somehow I fail to see two separate variables in your "solution".

      Granted, but you should care about trailing empty lines.

      Cheers Rolf

      UPDATE:

      for completeness ($pre,$post)=split /((?:\n.*){16}$)/,$txt