> On Fri, Dec 07, 2001 at 10:01:05AM +1100, [EMAIL PROTECTED] wrote:
>> --- mid.pl  ---------------------------------------------
>> #!/usr/bin/perl -p0
>> $_=$1while/.^(.+)^/ms
> Someone want to explain why this works?

It repeatedly keeps everything but the first and last
line of the file, thus removing the first and last line.

The first . prevents the ^ from matching at the beginning
of the string, making it match at the beginning of the
second line instead.

The trailing ^ stops the (.+) from matching everything,
keeping the last line out of the match.

- Karsten

Reply via email to