Refactor perl style into javaScript style varaibles