tart has asked for the wisdom of the Perl Monks concerning the following question:
Cheers,#! /usr/bin/perl env use strict; use warnings; my $hash; while(my $line = <DATA>) { my ($key, $val)=split(':',$line); $hash = ini($key,$val); } foreach (keys %$hash) { print "$_\n"; } sub ini { my ($key,$val)=@_; my %ini_hash; $ini_hash{$key}=$val; return \%ini_hash; } __DATA__ Name: Sam Address: Mascot Ph.No: 123321
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash Add new elements through loop
by GrandFather (Saint) on Mar 24, 2010 at 00:01 UTC | |
|
Re: Hash Add new elements through loop
by kiruthika.bkite (Scribe) on Mar 24, 2010 at 03:39 UTC |