in reply to How much can this text processing be optimized?

if the only criteria for garbage is having a number in it, your first while loop could be:
while (<STDIN>) { $MyString = $MyString . $_ unless ( /\d/ ); }
i think that would help somewhat. (untested code)