The easiest way is to use the tools that CPAN provides you with...
use Data::Visitor::Callback; my $visitor = Data::Visitor::Callback->new( hash => sub { my $new = {}; while ( my ( $key, val ) = each %{ $_ } ) { $key =~ s/\s+//g; $new->{ $key } = $val; } return $new; }, ); my $without_spaces = $visitor->visit( \%global );
In reply to Re: removing the spaces from keys of a complex hash
by jasonk
in thread removing the spaces from keys of a complex hash
by gwhite
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |