in reply to Perl & JavaScript

A few ways (without giving detailed JavaScript code):