modified perl script