in reply to removing the spaces from keys of a complex hash
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 );
|
|---|