#!/usr/bin/env perl use strict; use warnings; use IO::Prompt; sub shall_we { my $ans = prompt( "What'll it be?", -menu => { 'Yes, definitely.' => 1, 'No way.' => 0 }, ); print "Inside function, you chose: $ans.\n"; return $ans; } if ( shall_we() ) { print "In the 'if' statement: yes, we shall.\n"; } else { print "In the 'if' statement: no, we shant.\n"; }