Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Delete space at the end of a hash element

by vinoth.ree (Prior)
on Mar 26, 2013 at 11:06 UTC ( #1025501=note: print w/ replies, xml ) Need Help??


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

Update:

Oops!!! I have given script to remove white spaces from values of hash...

I want to delete all the spaces at the end of each element

use strict; use warnings; use Data::Dumper; my %var_h =(1 => " value", "2" => "two "); s/(\s+)$//g for values %var_h; print Dumper \%var_h;

The element should only consist of characters, no spaces at all.

use strict; use warnings; use Data::Dumper; my %var_h =(1 => " value", "2" => "two "); s/\s+//g for values %var_h; print Dumper \%var_h;

All is well


Comment on Re: Delete space at the end of a hash element
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2015-07-04 00:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls