Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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 wandering the Monastery: (5)
As of 2014-12-20 16:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (96 votes), past polls