NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Performance of contextual variables (Score:1)
Hi patrick
while I agree that contextual variables are a very neat solution, do they not make using these variables very slow?
Even when not using contextual variables explicitly, every use of say() would need to check that no caller has overridden the value of $*OUT
Clint
Re: (Score:2)
From what I can tell, contextuals don't appear to me to be all that much slower than ordinary lexicals. There might be a case where a deeply nested call stack could increase the search time, but I suspect that will be rather rare.
Beyond that, there are all sorts of ways to optimize for the cases where speed ends up being more important than flexibility. For example, a block that is going to make a lot of calls to say() can do:
and this will reduce the number of caller con