Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. threepwood

    Find array index

    I have solved the problem with 2 arrays. @p_prov contain the positions for one only chromosome, and %p has the before and after genes for all chromosomes. Then, I add the first gene ($p_prov[0]) to the last element. But the first element has already the right before and after genes, because...
  2. threepwood

    Find array index

    I have just realize that mi circle chromosome will have 2 repeated element in the ends. Will it work? If it doesn't work, I will include a sub-name to these 2 elements.
  3. threepwood

    Find array index

    Thanks, it is a nice code. I will compare both of them, and I will try to understand the map function. My array contains the first element in the last position too, and the last element in the first position. So I have something similar to a circle. Thanks again and salu2, Threepwood.
  4. threepwood

    Find array index

    My chromosome size could grow very much, with new ones, and so it would take a lot of memory. But it seems as a nice alternative. Thanks! Please somebody could explain the 'map' alternative? I will now try your code, Kevin. Salu2, Threepwood.
  5. threepwood

    Find array index

    Well the array contains a list of gene identifiers, ordered by the position in the chromosome (similar to a line): @positions = (P122343,Q281170,X726001,...); And $id is one of them. I have a list of genes and I want to know what are both the previous and the following genes to each one. The...
  6. threepwood

    Find array index

    Sorry, could you explain the code. I am a little novice in this kind of code :-( I have tried this one, but it doesn't work: $i=0; $a="c"; @array = (a,b,c,d,e,f); print map{$index{$a}=$i++}@array; I have a static array and I need call to my subrutine many, many times: my ($before, $after)...
  7. threepwood

    Find array index

    Thanks, I have tested the code from the brigmar's link, and it naturally works: my( $found, $index ) = ( undef, -1 ); for( $i = 0; $i < @array; $i++ ) { if( $array[$i] =~ /Perl/ ) { $found = $array[$i]; $index = $i; last; } } But I thoughted that there was a way similar to the...
  8. threepwood

    Find array index

    Hi, I would like to take the index from an array, if I know the value. E.g. I have the array: @var = (a,b,c,d,e); and I would like to know the position of the element 'c' into the array (i.e. 3). Is there any way to get this one with 'grep' or another function? Salu2 and thanks in advance...

Part and Inventory Search

Back
Top