#!/usr/bin/perl use warnings; use strict; use Tk; require Tk::ROText; my %answers; while () { chomp ( my ( $key, $val ) = split /,\s+/ ); push @{$answers{$key}}, $val; } #print "$_ ", join( ", ", @{$answers{$_}} ), "\n" foreach sort keys %answers; my $mw = new MainWindow; my $txt = $mw->Scrolled('ROText', -scrollbars=> 'ose')->pack; my $ent = $mw->Entry(-bg=>'white')->pack(qw/-fill x -pady 5/); $mw ->bind('' => sub { $ent->Tk::focus }); $ent->bind('' => [\&answer]); MainLoop; sub answer { my ($ent) = @_; my $text = $ent->get; $ent->delete(qw/0 end/); print $text, "\n"; if( ! exists $answers{$text} ){ $txt->insert('end',"$text No Luck\n"); }else{ $txt->insert('end',"$text @{$answers{$text}}\n"); } } __DATA__ What, on second Who, on third When, pitching Where, on first Why, catching How, second Whose, thats what I said