check perl in function