Xref:Perl/c fgets()

From CoderGuide

Jump to: navigation, search

Reading in a line of text in Perl similar to C's fgets

Reading in a line of text is very easy in Perl. You surround the file handle in angle brackets <> and....

#now let's get rid of that pesky newline
print "$line\n";
#we could also use this in a loop...
   #when used in this way, the line read is saved in $_
   print $_;
}## will continue until EOF is reached.
Personal tools