You don't want the and $_ ne ".\n" in the condition statment. Take that out and put something like:
if ($_ eq ".\n") {last;}
just before the push line.
#!/usr/bin/perl -w
use strict;
use diagnostics;
my (@lines);
while (<>) {
if ($_ eq ".\n") { last;}
push @lines,$_;
}
foreach (reverse @lines) { print; }