in reply to Re(2): where to declare a variable...
in thread where to declare a variable...
In perl the lexical creation of my is a compile time action, The only run time effect is that it is asigned to or set to undef. local on the other hand is a run time directive and will have a speed penalty.
There is still a cost of entering and leaving lexical scopes in perl, but it is incured reguardless of variable declarations.