Re: creating hash from scalar variable
- From: rob.dixon@xxxxxxx (Rob Dixon)
- Date: Mon, 30 Apr 2007 01:33:12 +0100
Rodrick Brown wrote:
use Data::Dumper;
my %h;
map { $h{$_->[0]}=$_->[1] } map { [ split/=/,$_ ] } split/\n/,$test;
print Dumper(\%h);
Or, more intelligibly,
my %h;
foreach (split /\n/, $test) {
my ($key, $val) = split /=/;
$h{$key} = $val;
}
Rob
.
- References:
- creating hash from scalar variable
- From: Goksie
- Re: creating hash from scalar variable
- From: Rodrick Brown
- creating hash from scalar variable
- Prev by Date: Re: creating hash from scalar variable
- Next by Date: Re: creating hash from scalar variable
- Previous by thread: Re: creating hash from scalar variable
- Next by thread: Re: creating hash from scalar variable
- Index(es):