Rodster001 has asked for the wisdom of the Perl Monks concerning the following question:
I want to do this in one line but I am having trouble coming up with a solution. $v is an array ref of hashes and each hash in the array has a "name" element and I want to create a string joining that value.
Something like:
I am able to reference a value of name specifically doing this:my $res = join(",",@{$v}->{name}); # not working
So I am not quite sure why my join above is not working. Can this be done in one line? Please enlighten me, thanks!my $name = ${$v}[0]->{name};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Joining an array of hashes
by kyle (Abbot) on Dec 11, 2008 at 18:43 UTC | |
|
Re: Joining an array of hashes
by jeffa (Bishop) on Dec 11, 2008 at 18:37 UTC | |
by Rodster001 (Pilgrim) on Dec 11, 2008 at 19:02 UTC |