in reply to errors
perl is complaining about your while-test.
You have to test with defined, like this:
while( defined($_ = <>) && $_ ne "quit\n" ) {}
The reason, as stated in the error message, is because the
<> may generate a "0", and that would evaluate
to false. With defined however, it will evaluate to true.
Newer perls usually puts the defined() around any such simple constructs as $_ = <SOME_HANDLE>. (within a while). Take this as an example:
However, this is not done with more complicated constructs such as yours.perl -MO=Deparse -le 'while($_ = <>) {}' -e syntax OK while (defined($_ = <ARGV>)) { (); }
Autark.
|
---|
In Section
Seekers of Perl Wisdom