[sf-perl] oddity with an exported and localized variable

yary not.com at gmail.com
Thu Nov 26 08:24:18 PST 2009

Running in perl 5.10.1 shows:

initial value: initial
the new value: new value
check_value_exported_sub sees:
exported_variable: initial
check_value_local_def sees:
exported_variable: new value

that is, same as what you saw in 5.10.0

Based on the perlsub section "Temporary Values via local()":
       A "local" modifies its listed variables to be "local" to the
       block, "eval", or "do FILE"--*and to any subroutine called from
*       *that block*.  A "local" just gives temporary values to global
       package) variables.  It does not create a local variable.  This is
       known as dynamic scoping.  ...

Emphasis is in the original perldoc. So it looks like a bug to me too. Bring
it to the monks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20091126/df58af77/attachment-0001.html>

More information about the SanFrancisco-pm mailing list