in reply to Perl as embedded script language
Yes
Is there an easier way?
Use javascript ( SpiderApe).