On Wed, Jul 06, 2005 at 12:10:43AM +0100, Fergal Daly wrote:
> On 7/5/05, Andrew Pimlott <[EMAIL PROTECTED]> wrote:
> > my $x = [];
> > sub one_way = { $x }
> > sub another_way = { [] }
> > sub test = { $_[0] == $x }
> > 
> > I don't think this breaks your rules, but see below.
> 
> You're right, I messed that up by trying to allow the use globals in
> the structure.
> 
> If you don't use globals (you can still have lexically scoped globals
> in the wherever one_way() and another_way() are defined, as long as
> test() has no way of reaching them) then it's true, if you do want to
> use globals then you actually have to test

Can you clarify--do you consider $x in my example a global, since it's
file-scoped?

> Kind of. The point was that you can't even refer to $a (the one that's
> in the do block) or $b in this situation.

But my point was that you can, if something outside has a reference to
$a or $b.  I was referring to $a through $x.  $x is perfectly good
whether we returned $a or $b.  This doesn't require globals (unless
you're calling a file-scoped lexical a global).

> None, I came up with the same example just as I was getting into bed.

:-)

Andrew

Reply via email to