|The stupid question is the question not asked|
Scalar data & collection data with Tree::Trieby Endless (Beadle)
|on Jul 04, 2013 at 14:40 UTC ( #1042466=perlquestion: print w/replies, xml )||Need Help??|
Endless has asked for the wisdom of the Perl Monks concerning the following question:
Hello all! I'm just getting started at learning Perl and am converting a Java program of mine to Perl for both learning and because I think Perl should handle the task well. I've read through a couple books on Perl but am still getting my Perl-coding legs (and will be for some time, it seems).
Here we are: I'm creating a Tree::Trie that reads from a 4-column CSV to create a lexicon. The first column is the actual word to add to the tree, and works fine. But now I am trying to add the other columns (starting with just one) as data onto that node and could use some help. Here's what I've got:
I just arrived at this and it actually works, but it came after hours of failing to get a data retrieval in scalar context to function; it would always just return the word again.
So, I have two questions: first, what do I need to do to get a single piece of data out in scalar context with Tree::Trie? I have a suspicion that I am making some Perl-novice mistake in that.
Second, attaching and retrieving multiple pieces of data for a word. I know it will have to do with attaching an array at the data I'm adding; can anyone give me a friendly example of how the attachment/retrieval would look in that case?
Thank you much! I am pleased to be here with the monks.
Back to Seekers of Perl Wisdom