> [bwarnock@capita.com - Mon Sep 03 10:43:30 2001]: > > > ----------------------------------------------------------------- > Local variables declared in a conditional expression of a > conditional block are not restored at the end of scope. > > $a = 10; > if (local $a = 1){ > } > print $a; # Should be 10, not 1 > > Applies to local variables declared in 'if (expr)', 'unless(expr)', > and 'elsif (expr)'. Lexical variables are okay, as are local > variables in the conditional expression of a loop block. > This behavior has been fixed in bleadperl by not allowing it. > ./perl rt_7615.pl Can't localize lexical variable $a at rt_7615.pl line 4.Thread Previous | Thread Next