my %document = ( '1' => { '1.1' => 'xxx', '1.2' => { '1.2.1' => 'xxx', '1.2.2' => 'xxx' } }, '2' => { '2.1' => { '2.1.1' => 'xxx' } } ); #### sub process (%chapters) { await do for %chapters.kv -> $number, $content { start { note "Chapter $number started"; &?ROUTINE.outer.($content) if $content ~~ Hash; sleep 1; # here the chapter itself is processed note "Chapter $number finished"; } } } process(%document);