$/ = "\n"; open(REVERSE_FILE, "|/usr/bin/tac $filename"); while () { print "$_\n"; } close REVERSE_FILE;