perl script is able to arrange the format of magic data