in reply to Re^2: Can't use an undefined value as a HASH reference
in thread Can't use an undefined value as a HASH reference

Ok, so now take a step back, and tell us what data you are sending into your script, ie. how you are calling it and with what arguments (post a example snip from the input file).

We need to know what is in $line. I can't get to the link with the rest of the code, so I'm unsure how build_subtree compiles its data, and what it expects to find. Do you have another link, or can you post the full code?

Replies are listed 'Best First'.
Re^4: Can't use an undefined value as a HASH reference
by Anonymous Monk on Aug 25, 2015 at 16:32 UTC

    Thank you'll very much for the pointers. It helped me trace through the problem. It's now resolved. I see build_tree was expecting a string that began with parenthesis, like so: "(TOP (S (NP (NP (NNP Pierre) (NNP Vinken))".

Re^4: Can't use an undefined value as a HASH reference
by Anonymous Monk on Aug 25, 2015 at 16:15 UTC

    The build_subtree subroutine has a sanity test line as follows

    if ($line !~ /^\(.*\)\s*$/) { print "here: $line\n"; return undef; }

    And input $line has "1 , 4885".