Added some validation to perl file