un-optimized wx perl code