Perl script to standardize the input format