while (my $line = <>) { chomp $line; my $tree = build_subtree($line); print Dumper $tree->{children}[0]; print Dumper $tree; walk_postorder($tree,[\&mark_heads,\&annotate]); @{$tree->{children}}[0]->{label} =~ s/^\*//; # undo top-level merge print build_subtree_oneline($tree,1), $/; }
I did have to use both prints. They gave output below.
$VAR1 = undef; $VAR1 = { 'children' => [] };
Not sure where to go from here. But would the $line input be the cause of the problem? The build_subtree($line) subroutine uses it as input.
Also, the correct link to the original script is here: https://github.com/mjpost/dptsg/blob/master/scripts/annotate_spinal_grammar.pl
In reply to Re^2: Can't use an undefined value as a HASH reference
by Anonymous Monk
in thread Can't use an undefined value as a HASH reference
by Anonymous Monk
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |