[EMAIL PROTECTED] wrote: > Hi , > > Say I have an array in perl, > > @list = ("a=3", "b=5", "c=8", "d=9", "e=2", "f=0");
looking at your list a hash seems like a better option, the hash will be like %hashlist = ( a => 3, b => 5, c => 8, d => 9, e => 2, f => 0); the reason being, you are associating the numeric values (3, 5, 8 etc.) to the characters (a, b, c etc.) a hash (associative array) would be more useful here. Is my assumption correct? To access the element 'd' you will say $hashlist{d} You can get more information on hashes from perldoc perldata > > > Now I want to find the index of the element "d=9" ( Index of d=9 is 3 here , as > we all know ). > > How do we do that ?? > > In perl what I can find that there exist a function "index", which returns > position of the substring in string..........like, > > $c = index(@list, "d" ); > > > This function will return me the value 13 or 12 perhaps....as the substring > "d=9" begins from 13th position in the @list. > > My requirment is : > > $c = some_func(@list, "d"); .............where some_func should return me > 3......... Can anybody help me. > > TIA, > -Mini. > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]