Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Delete space at the end of a hash element

by space_monk (Chaplain)
on Mar 26, 2013 at 12:43 UTC ( #1025514=note: print w/replies, xml ) Need Help??

in reply to Delete space at the end of a hash element

Ye Olde Fashioned Waye.....

my %newhash; while (my ($k, $v) = each( %hash)) { $k =~ s/\s+$//; $newhash{$k} = $v; } # newhash contains correct key values
A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025514]
[Corion]: A good daystart to everybody!
[Corion]: Just a quick poll - is anybody actively relying on https://perlmonks. I plan to retire that URL in favour of moving all our servers onto the same HTTPS certificate for perlmonks.{com, net,org}
[Corion]: Actually bsd_glob '{www.,}perlmonks .{com,net,org}', plus I think
[Corion]: Sad that Let's Encrypt does not allow wildcard certificates, but they could be somewhat of a hassle to verify

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2017-09-26 07:45 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (292 votes). Check out past polls.