for my $scene ( keys %act ) { print "SCENE $scene:\n"; print "$searchterm:\n", join "\n", @$_ for @{$act{$scene}}; }