Hello Balaji,

I have been using shell script for my admin work and recently decided to use
perl fo all my automation. So proud I did that.

Nice to know that you have decided to use Perl.

Quick question:  I have been using "Select" function in shell to present
menu to users. Do we have a "select" equivalent in perl? Or if I have a list
of names in an array what is the best way to present them in a menu and
prompt the user to select one from the list?

The task is very easy to implement using IO::Prompt:

=pod code

use IO::Prompt;

my @names = qw( foo bar baz qux );
my $selected_name = prompt 'Please select one name: ', -menu => \@names;

print "Selected name: $selected_name\n";

=cut code

Regards,
Alan Haggai Alavi.
--
The difference makes the difference

--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to