Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Is there a "good" way to do this? (Not involving deparse?)#!/usr/bin/perl use warnings; use strict; use Data::Dumper; $Data::Dumper::Deparse = 1; package p1; our $x = 1; my $func = sub { print $x,"\n" }; $func->(); package p2; our $x = 100; $func->();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: anonymous sub, packages, global variables
by LanX (Saint) on May 17, 2011 at 18:25 UTC | |
|
Re: anonymous sub, packages, global variables
by ikegami (Patriarch) on May 17, 2011 at 18:27 UTC | |
|
Re: anonymous sub, packages, global variables
by wind (Priest) on May 17, 2011 at 18:38 UTC | |
by LanX (Saint) on May 17, 2011 at 18:45 UTC | |
by wind (Priest) on May 17, 2011 at 18:49 UTC | |
by LanX (Saint) on May 17, 2011 at 18:54 UTC |