#!/usr/bin/perl use warnings; use strict; use YAML; # hash to YAML: my %hash = (name => "Ken", age => 30); my $hashref = \%hash; my $dumpstring = Dump($hashref); # Write YAML-file: open(FH, ">storehash.txt") or die; print FH $dumpstring; close(FH); # Read YAML-file: open(FH, "; close(FH); my $b = join("\n", @a); # YAML to hash: my $hr = Load($b); my %newhash = %{$hr}; foreach my $i (keys %newhash) { print "$i => $newhash{$i}\n"; }