in reply to How do I return a hash from Parse::RecDescent?
I know this is too naive. I am sure some other smarter guys will make it into one liner.#!/usr/bin/perl use Data::Dumper; $var = [ { x => 1 }, { y => 2 }, { z => 3 } ]; my %res; foreach my $v (@{$var}) { my ($k) = keys %$v; $res{$k} = $v->{$k}; } print Dumper \%res;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I return a hash from Parse::RecDescent?
by Anonymous Monk on Sep 22, 2006 at 11:04 UTC |