I have a yaml file which looks like this:
---
date: 25-01-2010
version: 0.1
I want to edit it. I using this code:
use YAML::XS qw(LoadFile);
use YAML::Syck qw(Dump);
my $list = LoadFile("config.yaml");
$list{date} = "12-11-2011";
print "The date is $list->{date} \n";
print "The version is $list->{version} \n";
open F, '>', "config.yaml";
print F Dump( \%list );
close F;
}
and when it's done my yaml file contains only date and empty line in the end.
---
date: 12-11-2011
What's wrong with this code? if I checking value version before writing I getting good result, it's showing version but it doesn't write it at all...
I tried to use YAML::Syck::DumbFile but file after writing wasnt contain version too, and it was look like this :
---
date:
12-11-2011