|Perl Monk, Perl Meditation|
More efficient munging if infile very largeby ybiC (Prior)
|on Jul 26, 2001 at 15:14 UTC||Need Help??|
ybiC has asked for the wisdom of the Perl Monks concerning the following question:
The code at bottom works fine for converting all alpha characters in a text file to upper (or lower) case. But having the two "$munged = " lines inside the "for(@in)" loop looks like ineficient if handling large files.
I tried these two tweaks to move that logic outside the for(@in) loop. The first doesn't work because (correct me if I'm wrong) $_ is empty when $munged is declared. The second fails with this compilation error: syntax error at uclc.pl line (push @munged, $munged();), near "$munged(" and I'm not clear just what's happening there.
So my questions for the wise bretheren and sisteren are:
striving toward Perl Adept
(it's pronounced "why-bick")