Read line splitted by space
!#c:\perl\bin
print "Content-type: text/html\n\n";
open(MYFILE, "c:/personnel.dat") || die print "Error encountered opening file ... $!";
while(defined($dataline=<MYFILE>))
{
print "Reading file ...<br>";
@fields = split(/ /, $dataline);
}
foreach $field(@fields)
{
print "$field <br>";
}
close(MYFILE);
Related examples in the same category