#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11152489 use warnings; my @animals = (qw( cow camel dog cat )); # slightly changed from 11150326 my @foods = (qw( fish pasture meat )); my @places = (qw( wood sea desert )); my $commands = { select => { completion_list => [@animals], commands => { give => { completion_list => \@foods, }, take_to => { completion_list => \@places, }, }, }, kill => { completion_list => [@animals], } }; use YAML qw( DumpFile LoadFile ); my $originalfile = 'original.11152489'; my $changedfile = 'changed.11152489'; DumpFile $originalfile, $commands; $commands->{select}{commands}{give}{completion_list}[0] .= 'es'; DumpFile $changedfile, $commands; system "diff -u $originalfile $changedfile"; use Data::Dump 'dd'; dd 'original', LoadFile $originalfile; use Data::Dump 'dd'; dd 'changed', LoadFile $changedfile;