in reply to Whats quicker - passing along as variable to sub, or global var?
In snippet 1:
$long_content = ... # Long string copy 1. $new_contents = ... # Long string copy 2.
In snippet 2:
$main_vars{content} = ... # Long string copy 1. $old_content = ... # Long string copy 2.
They are going to be similar since the parts you said are slow occur in both versions. Moving the slow parts around doesn't make things faster.
|
|---|