On Sat, Jul 28, 2001 at 03:45:50AM +0530, Sudarsan.Raghavan wrote:
> What is the reason for this difference in behavior.
If you were simply looking for verification that "<STDIN>;" not reading from
$_ is correct, it is. If you were looking for a reason behind the potential
inconsitency with "while (<STDIN>)" then continue reading.
while (<STDIN>) is a special case, introduced because people would often
say:
while (defined($_ = <STDIN>))
So it was likely decided, at some point, to make this easy task easier. For
consistency perhaps simply "<STDIN>;" should have placed a line into $_, but
at this point it's become a backwards compatability issue to change the
behaviour. Now, "<STDIN>;" is used to throw away a line of input, having it
clobber whatever is in $_ at the time could cause problems.
This is my thinking behind it, perhaps the original design difference came
about for some other reason.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]