Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Introducing spaces between the values in a hash of hashes

by Kenosis (Priest)
on Jan 24, 2014 at 21:17 UTC ( [id://1072002]=note: print w/replies, xml ) Need Help??


in reply to Introducing spaces between the values in a hash of hashes

It's not too pretty, but you can use the baby-cart:

use strict; use warnings; use Storable; my %h2; my %hash = ( 'roster' => { 'mike' => 'biology', 'carol' => 'math', 'tom' => 'history', }, 'courses' => { 'math' => 'full', 'biology' => 'open', 'art' => 'open', } ); store( \%hash, "test.dat" ); %h2 = %{ retrieve "test.dat" }; for ( sort keys %h2 ) { print "$_: @{[values %{$h2{$_}}]}\n"; }

Output:

courses: open full open roster: history math biology

Hope this helps!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1072002]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-03-28 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found