my @lines;/^$/ && last, s/\r?\n$//, push(@lines, $_) for <>;print @lines;
1st line 2nd line 4th line 5th line
1st line2nd line
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!