in reply to Re^2: Scalar data & collection data with Tree::Trie
in thread Scalar data & collection data with Tree::Trie

my ($var) is imposing list context, $var will contain the first element of the list returned (in this case the word).

With regards to your code there's nothing really wrong with it but, unless you need the intermediate variables for something else, it could be shortened to:

while (my $fields = $csv->getline( $data )) { my $word = $fields->[0]; $trie->add_data( $word => [ $fields->[1], $fields->[2], $fields->[ +3] ] ); my $info = $trie->lookup_data($word); printf "Just added %s\n Sentiment: %s \t Neg Sentiment: %s \t Topi +c: %s\n", $word, $info->[0], $info->[1], $info->[2]; }