Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^2: Alternative to sort Hash

by AnomalousMonk (Archbishop)
on Dec 06, 2019 at 21:23 UTC ( [id://11109778]=note: print w/replies, xml ) Need Help??


in reply to Re: Alternative to sort Hash
in thread Alternative to sort Hash

It could be even simpler than that. Assuming operations on an array, if one can get the array into a function and decide on a regex to match the desired language:

sub func { ... return unless my @wanted = grep m{ $rx_wanted }xms, @voices; return $wanted[ -1 ]; }
func returns undef if no desired language is found, the last language if more than one is found, and the first if there is only one. If one didn't want the last language in the case of more than one, maybe something like
    return $wanted[ @wamted > 1 ? 1 : 0 ];


Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109778]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-18 15:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found