Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: removing the spaces from keys of a complex hash

by jasonk (Parson)
on May 08, 2008 at 00:53 UTC ( [id://685367]=note: print w/replies, xml ) Need Help??


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 );

www.jasonkohles.com
We're not surrounded, we're in a target-rich environment!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://685367]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 22:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found