in reply to Re: Perl replacement for choice.com
in thread Perl replacement for choice.com
I believe I know one area you were talking about but I am not certain of the second. Removing all the comments, is this what you mean?
if ( defined $default ) { my $stderr; close STDERR; open(STDERR, ">", \$stderr); my $grabkey_thread = threads->create(\&grabkey); $grabkey_thread->detach(); for ( my $i = 0; $i <= $timeout; $i++ ) { sleep 1; } my $pos = index( uc( $choices ), uc( $default ) ) + 1; print uc( $default ) . "\n"; exit $pos; } else { grabkey(); } => if ( defined $default ) { my $stderr; close STDERR; open(STDERR, ">", \$stderr); my $grabkey_thread = threads->create(\&grabkey); $grabkey_thread->detach(); for ( my $i = 0; $i <= $timeout; $i++ ) { sleep 1; } my $pos = index( uc( $choices ), uc( $default ) ) + 1; print uc( $default ) . "\n"; exit $pos; } grabkey();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Perl replacement for choice.com
by Tux (Canon) on Mar 04, 2013 at 22:10 UTC | |
by onelander (Sexton) on Mar 04, 2013 at 22:16 UTC |
In Section
Cool Uses for Perl