Mega Code Archive

 
Categories / Perl / File
 

Contents of the entire file are printed

#!/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);