From perl-beginners Tue Jan 10 08:04:00 2017 From: Luca Ferrari Date: Tue, 10 Jan 2017 08:04:00 +0000 To: perl-beginners Subject: deprecated idiom to simulate state variables Message-Id: X-MARC-Message: https://marc.info/?l=perl-beginners&m=148403550827637 Hi all, I guess it was in Modern Perl that I saw this deprecated idiom to simulate state variables: sub foo{ my $initialized_once = 1 if 0; ... } Now, why is that working and initializing the variable the first time? I mean, each time such row is evaluated the condition is 0 = false, so the variable should not be initialized never. What am I missing? Thanks, Luca -- To unsubscribe, e-mail: beginners-unsubscribe@perl.org For additional commands, e-mail: beginners-help@perl.org http://learn.perl.org/