http://www.perlmonks.org?node_id=132616


in reply to Conditionally Changing a Variable

Works fine for me, without the typo. Was that a cut-n-paste error, or is that your actual code (with the c$ instead of $c in your conditional)?
my $c = -5; print "C is now $c\n"; $c = 0 if ($c < 0); print "C is now $c\n";