#!/opt/perl5/bin/perl -w use strict; my ($line, @lines); while($line=<> and $line ne ".\n"){ push @lines,$line; } foreach(reverse @lines){ print; }