IN is a filehandle
Preceding the filename is a redirection character.open(IN, ">test"); print IN "In we go"; close(IN);
$filename = $ARGV[0]; #get command line argument
open(IN, "<$filename");
$line = <IN>; #read the first line
print $line;
while(<IN>) { #loop as long as not EOF
print $_; #loop variable -- contains current line
}
There are many short cut features in Perl. In particular, there are a
host 'special variables' like $_.
The Geometry Center Home Page
Comments to:
webmaster@geom.umn.edu
Created: May 08 1996 ---
Last modified: Wed Jun 5 15:57:21 1996