open (IN, "< $file") or warn ("Can't open $file: $!\n"), die; chomp(my @data = ); # read all lines into array of lines # and get rid of trailing \n's print "$_\n" for @data; close(IN);