Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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'
};

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 taking refuge in the Monastery: (3)
As of 2016-07-27 06:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (242 votes). Check out past polls.