in reply to Search an array for values sequentially
I'd use a hash for this rather than an array, something along these lines:
%supported_security = ( "WPA" => "WPA", "WPA2" => "WPA2", "WEP 64" => "WEP 64", ... );
And then just probe that hash in order of preference of security type:
$best_type = $supported_security{"WPA2"} // $supported_security{"WPA"} // $supported_security{"WEP 128"} // ...
with // being the logical defined-or operator (see Logical Defined Or); if that's not available on the version of Perl you're using, use || instead.
|
|---|