Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Shortest -return index of element in array- sub

by lindex (Friar)
on Mar 24, 2001 at 00:27 UTC ( #66731=note: print w/ replies, xml ) Need Help??


in reply to Shortest -return index of element in array- sub

this works:

#!perl use strict; sub iA{join('',map{$_ if($_[0]eq$_[$_])}(1..$#_))-1} my(@array) = qw(foo bar crap stuff); print "$_: ".iA($_,@array),"\n" for(qw(foo dolsman crap));
just my two cents :)



lindex
/****************************/ jason@gost.net, wh@ckz.org http://jason.gost.net /*****************************/


Comment on Re: Shortest -return index of element in array- sub
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2015-07-06 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls