M. Lewis wrote: > > In my most recent postings, I was dealing with first HoA and now HoH. > > In my previous example code, I ended up with an output that looked > something like this: > > jelly -- strawberry apple grape pear > jam -- strawberry apple grape > milk -- plain strawberry chocolate > > I thought I'd prefer to have it listed more like this: > > jelly -- strawberry > apple > grape > pear > jam -- strawberry > apple > grape > milk -- plain > strawberry > chocolate > > > 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"; > }
Try it like this: for my $i ( keys %HoH ) { my $key = "$i -- "; print $key, join( "\n" . ' ' x length $key, keys %{ $HoH{ $i } } ), "\n"; } John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/