perl code cleanup