Various helpful perl code