On Thu, Sep 05, 2002 at 06:48:29PM +0100, Paul Makepeace wrote:
> On Thu, Sep 05, 2002 at 01:37:05PM -0400, Selector, Lev Y wrote:
> > while ($choice = uc <>) {
> >   $choice =~ s/(^\s+|\s+$)//g;
> >   $choice = 'Y', last if ($choice =~ /^Y?$/);
> >   $choice = 'N', last if ($choice =~ /^N$/ );
> 
> How about here,
> 
>   $choice = $1, last if $choice =~ m/^\s*(N|Y?)\s*$/;
> 
> ...and drop the two lines above it.
> 
> I'd personally use $_ but that's your $choice :-)

This doesn't set choice for the Empty string case. I'd use:

while (<>) {$choice = uc $1||"Y", last if /^\s*(N|Y?)\s*$/i}

CU,
    Sec
-- 
"This 'telephone' has too many shortcomings to be seriously considered
as a means of communication. The device is inherently of no value to
us." -Western Union internal memo, 1876

Reply via email to