die("Invalid data: Multiple roots\n") if @roots > 1; my $root = $roots[0]; ...