Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Try this:
#!/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"; }
On my system, it always tells me "yes, we shall", regardless of which option I choose.
I've got IO::Prompt 0.99.4 and this is Perl 5.10.0.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: IO::Prompt -- why isn't this working (menu with hashref)?
by Fletch (Bishop) on Jun 20, 2008 at 21:24 UTC | |
by ikegami (Patriarch) on Jun 20, 2008 at 22:19 UTC | |
|
Re: IO::Prompt -- why isn't this working (menu with hashref)?
by andreas1234567 (Vicar) on Jun 23, 2008 at 05:13 UTC |