categorical perl script