Chris San wrote:

It is supose this code prints the first line of file text.txt (which is not empty), but it doesn't print anything.


$file = "text.txt";
open (file);
<file>;


The above statement does not store the result in $_, this is special only inside a while statement
while (<file>) is equivalent to while (defined ($_ = <file>))
perldoc perlvar
perldoc perlsyn



print; close (file);


I understood that <file>; gets a line (the first in this case) and, in this case, it puts the line in $_ . Also, print; (without args) prints the content of $_ .


Any idea about it?





-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to