#!/usr/bin/perl use strict; use warnings; use IO::Prompt; my $example = "Example"; ( prompt "Enter your choice [y/n] : ", -yes_no ) ? print uc($example), "\n" : print lc($example), "\n"; #### OUTPUT : Enter your choice [y/n] : y EXAMPLE Enter your choice [y/n] : n example Enter your choice [y/n] : (Please answer 'y' or 'n')