#!/usr/bin/perl open(FILE, "<data.txt") || die "Can't open data.txt: $!\n"; @lines = <FILE>; print @lines; print "\nThe file contains ", $#lines + 1," lines of text.\n"; close(FILE);