use Term::Readline; $ENV{PERL_RL} = "Perl"; my $term = Term::ReadLine->new('sweet_ol_bus'); $term->Attribs->{completion_function} = sub { my $txt = shift; return grep { /^$txt/i } sort keys %$my_list_of_autocompletion; }; my $in; while ( defined ( $in = $term->readline( 'my_prompt>' ) ) ) { chomp ($in); ... }