This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ############################################## | |
| # $Id: myUtilsTemplate.pm 7570 2015-01-14 18:31:44Z rudolfkoenig $ | |
| # | |
| # Save this file as 99_myUtils.pm, and create your own functions in the new | |
| # file. They are then available in every Perl expression. | |
| package main; | |
| use strict; | |
| use warnings; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hash | |
| def deep_underscore(h = nil) | |
| nh = {} | |
| (h || self).each do |k,v| | |
| nk = k.underscore | |
| if v.is_a? Hash | |
| puts "key #{k} recusive" | |
| nh[nk] = deep_underscore v | |
| elsif v.is_a? Array | |
| nh[nk] = v.map do |eh| |