From: Radhika Sambamurti <mailto:[EMAIL PROTECTED]> wrote:
: thanks,
: radhika
:
: : If you're not reading from any other files, you don't
: : need the $count variable in this case. The special
: : variable $. holds the number of lines read since a
: : filehandle was last explicitly closed:
: :
: : 1 while <FILE>;
: : $count = $.;
: :
: : This reads all the records in the file and discards them.
: :
: Hi,
: was trying to reproduce the code [above].
: I was wondering what the 1 is doing before the while. Is
: it the exit status of the while, that is until eof is
: reached and exit code = 1 ?
'while' can be used as a statement modifier. When used
that way, it places each successive value in the $_ variable
and the line number of the file in the variable $. (And a
number of other things.)
If the statement doesn't do anything with $_ and doesn't
produce any other effect, it becomes irrelevant. 1 and 0
won't raise errors under strict and warnings.
0;
1;
2; # <--- raises a constant in void context warning.
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>