Re: Accessing the values of HoH



On 12/29/2006 12:22 AM, M. Lewis wrote:
[...]
I thought I'd prefer to have it listed more like this:

jelly -- strawberry
apple
grape
pear
[...]
So in the following snippet, I tried to add a "\n" onto the value of the HoH.

for my $i ( keys %HoH ) {
%{$HoH{$i}} = join ("\n", %{$HoH{$i}}, "");
print "$i -- @{[ keys %{$HoH{$i}} ]}\n";
}
[...]

I advise against changing the original keys. The variable $" determines what string is used to separate array elements expanded within a quoted string (read "perldoc perlvar"). I would set $" to "\t\n" before printing.

Good luck.



.



Relevant Pages

  • Re: Array to single row -- Any simple way to do this?
    ... > array of multiple rows and columns into one row of values which have ... > 1 Apple ... Pear ... > 2 Grape ...
    (microsoft.public.excel.misc)
  • Accessing the values of HoH
    ... I was dealing with first HoA and now HoH. ... jelly -- strawberry apple grape pear ...
    (perl.beginners)
  • RE: delete both duplicates
    ... run a pivot table on that column, which will give you a unique list of ... i want only pear and grape to appear? ...
    (microsoft.public.excel.misc)
  • Re: machine figure
    ... A pear, a plum, a grape, apple. ...
    (rec.puzzles)
  • Re: delete both duplicates
    ... Then filter to show the values greater than 1 and delete those visible rows. ... i want only pear and grape to appear? ...
    (microsoft.public.excel.misc)