On Jan 10, 2008 9:26 AM, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
> >   if ( $cnt = 0 ) {
>
> You are assigning 0 to $cnt so $cnt will always be false and the else
> block will always execute.
snip

This is one of the reasons the warnings and strict pragmas are so
important.  The warnings pragma would have told you that you had a
assignment instead of a comparison in your if.  You can turn on the
warnings and strict pragmas by saying this at the top of every Perl
program you write

use strict;
use warnings;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to