add bin/perl-motion.pl and modify sample code