http://www.perlmonks.org?node_id=655564

monkfan has asked for the wisdom of the Perl Monks concerning the following question:

Dear fellow monks,

For example I have an array as a repository and string as input.
my $input = $ARGV[0] || 'bar'; my @repo = qw (foo bar qux);
What's the compact way to find the index of 'bar' in @repo, such that finally it returns '2' (index in @repo).

Regards,
Edward