in reply to Re^3: Lexicographic tree (betters)
in thread Lexicographic tree

Hi tye

s/(.)/\{$1\}/g
Well. I don't remember why I used \1 instead of $1 but you're true : this is Perl code.

eval­("\$x$_\{­EOS}=0");
With $_ I get this warning:

Use of uninitialized value $_{"EOS"} in concatenation (.) or string at -e line 1, <> line X.
+ the code produces no data
With ${_} everything works just fine...

Considering the affectation {­EOS}=0, I wouldn't call it a bug as I didn't mean to get the string "EOS" in my tree.

END{sto­re(\%x,out­put)}
+1! You're right. It was quite wasteful :|

Thanks for your help.

Replies are listed 'Best First'.
Re^5: Lexicographic tree (betters)
by tye (Sage) on May 06, 2010 at 01:39 UTC
    eval­("\$x­$_\{­EOS}=­0");

    With $_ I get this warning:

    Use of uninitialized value $_{"EOS"} in concatenation (.) or strin +g at -e line 1, <> line X.

    Works for me. Based on the error, it looks like you failed to include the \ between $_ and {EOS}.

    Considering the affectation {­EOS}=0, I wouldn't call it a bug as I didn't mean to get the string "EOS" in my tree.

    If you didn't want that, then you should replace your {EOS} with ={} so the intent is clear instead of looking very much like a bug.

    Even if it isn't a bug compared to your intention, it is still a bug if you are trying to make a trie. With your implementation you can't tell that both "hill" and "hilly" are stored in one structure.

    - tye