On Nov 26, Michael J Alexander said: > Can someone tell me why this simple bit of code doesn't work? The >"If" statement prints even when it's false. > >$x = 20; >$y = 15.5; >$z = .05; >$a = $x+$y; > >print "a equals $a.\n"; > >if ($a = 20) {print "a is equal to 20.\n";}
No one has told you yet: you should be using warnings (-w). Perl would tell you: Found = in conditional, should be == at -e line 1. if you ran your code. You need to change your #! line to #!/usr/bin/perl -w -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]