#!/usr/bin/perl -w use strict; open(R,"textfile"); my @F=; close(R); pop @F if $F[-1] eq "\n"; print @F;