add script, perl version is too complicated!