in reply to More efficient munging if infile very large

I am unclear about the $munged() bit of code in your description. &$munged() would work, were $munged a code reference. As for the effeciency of your approach, i would run it all through Benchmark, for any other opinions would be but opinions. It maybe quicker to do something like
if ($uclc eq 'lc') { ... for loop with lc } elsif ($uclc eq 'uc') { ... for loop with uc } else { die "invalid arg"; }
it may be slightly fatser, but check benchmark
Thus spake the Master Programmer:
"When you have learned to snatch the error code from the trap frame, it will be time for you to leave."
-- The Tao of Programming