Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Hash Add new elements through loop

by kiruthika.bkite (Scribe)
on Mar 24, 2010 at 03:39 UTC ( #830441=note: print w/ replies, xml ) Need Help??


in reply to Hash Add new elements through loop

use strict; use warnings; use Data::Dumper; my %record; while (<>) { if(/(.*):(.*)/) { $record{$1}=$2; } } print Dumper \%record;

Input

Name : Hari
Ph.Num:123456
Address :Mascot


Output

$VAR1 = {
'Ph.Num' => '123456',
'Address ' => 'Mascot',
'Name ' => ' Hari'
};


Comment on Re: Hash Add new elements through loop
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-04 03:30 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