> Yeah, I don't think you can use .local across subs like that. I think > .local means "local to this sub" and *inner subs aren't closures*. In > fact, I don't think inner subs are useful for much of anything at all.
The more I read, the more likely I think this is a bug. For example, the note following the example in P6E (emphasis mine): .local string hello hello="Polly want a cracker?\n" print hello .sub _main hello="Hello, Polly\n" print hello end .end The first line of this example, the .local directive defines a *file global variable* named hello. The main routine uses the same variable, and would give a parse error if it hadn't been defined. "Polly want a cracker" is never assigned to the variable and printed. This just screams bug. Aside from that, I think .local should be my mechanism to create lexically scoped names at this level anyway (they serve a different purpose than scratchpads, globals, etc...). > If you're a compiler, what you probably want to do is set up a some > scratchpads and put f and x in them. So the perl code: The scratchpads are a good idea, but clumsy for what I wanted to do here.