use IO::Prompt::Hooked; my $string = prompt ( message => 'Input a string:', validate => sub { q{} ne shift } );