Hello,

What would be a more elegant (short) way to express the following:

while ($choice = uc <>) {
  $choice =~ s/(^\s+|\s+$)//g;
  $choice = 'Y', last if ($choice =~ /^Y?$/);
  $choice = 'N', last if ($choice =~ /^N$/ );
}

As you see, it is an infinite loop which wouldn't let you out unless you do:

'y','Y',<ENTER>  - 'Y'
'n','N'          - 'N'

  
Warmest Regards, 
Lev Selector

Reply via email to