in reply to Search an array for values sequentially
#!perl use strict; use warnings; my @preferred = qw(best good normal bad worst); my @routers = qw (asda adsas asdasds); foreach my $router(@routers){ my $best_of = best_of($router); } sub best_of { my $router = shift; my %available; @available{get_available($router)};# get_available return a list # used as keys of %available ha +sh # for our comfort map { return $_ if exists %avalable{$_} } @preferred; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search an array for values sequentially
by AnomalousMonk (Archbishop) on May 20, 2014 at 12:43 UTC |