#! /usr/bin/perl -w # scr07A.pl # How to access and open an external text file "Ref.txt"? # In PERL, there is no (void)main(void){ }. Just script from top to bottom. # In PERL, instead of C's Pointer (fp), FileHandle (IN) is used. # # $_ : This is called the default variable, that means in the context # it is obvious. In the following sample, $_ = <IN>, # it is the incoming each line. # open (IN, "Ref.txt"); while( <IN> ) ## Get One-line each time from an external file "Ref.txt". { print $_; ## Print out incoming each line one-by-one. } close (IN); ## Once finished the job, close the FileHandle (IN).