#!/usr/bin/perl -w use strict; use warnings; use YAML::Syck; my $hash = { 'k1'=>'v1', 'k2'=>'v2', 'k3'=>'v3', }; # Part 1 - works fine while ( my ($k, $v) = each(%$hash) ) { print "$k, $v\n"; } # Part 2 - unlimited cycle. Why???? while ( my ($k, $v) = each(%$hash) ) { print "$k, $v\n"; DumpFile("test.yml", $hash); }