Mega Code Archive

 
Categories / Perl / File
 

Reading from a file

#!/usr/bin/perl use strict; use warnings; open IN, "in.txt" or die "Can not open in.txt for reading : $!"; while ( my $line = <IN> ) {    print "file:$line\n"; } close IN or die "Can not close file : $!";