Syntactic Confectionery Delight | |
PerlMonks |
What is variable suicide and how can I prevent it?by faq_monk (Initiate) |
on Oct 08, 1999 at 00:27 UTC ( [id://691]=perlfaq nodetype: print w/replies, xml ) | Need Help?? |
Current Perl documentation can be found at perldoc.perl.org. Here is our local, out-dated (pre-5.6) version:
Variable suicide is when you (temporarily or permanently) lose the value of a variable. It is caused by scoping through
my $f = "foo"; sub T { while ($i++ < 3) { my $f = $f; $f .= "bar"; print $f, "\n" } } T; print "Finally $f\n";
The
|
|