miscellaneous perl code