[Bioperl-l] foreach (@array)?

Stephan Bour sbour at niaid.nih.gov
Wed Sep 10 13:44:30 EDT 2003


I believe you need to assign each array element to a scalar variable for the
foreach loop to work:
foreach $mirna (@mirna) {
Stephan.


> Hi,
> When I start my script, it return results only for first variable in @array,
> but in the raw 'foreach (@array){' in the @array there is two or more
> variables, but anytime it returns the result whit first variable:
> 
> foreach (@mirna) {
>    $id=$_; 
> while (my $RNA=$DB->next_seq()) {
>    $RNAid=$RNA->display_id;
>    if ($RNAid eq $id) {
>    $seqRNA=$RNA->seq();
>    }
>    else {next};
> 
> 
>  for (my $i=0; $i<length($geneRNA); $i++) {
>    $subgene=substr($geneRNA,$i,length($seqRNA));
>    $percentage = align_subs($seqRNA, $subgene);
> 
>     if($percent<$percentage) {
>      push (@RNAname,$id);
>      push (@subgene, $subgene);
>      push (@percentage,$percentage);
>      push (@position,($i+1));
>     }
>  }
> };
> };
> };
> Thanks! 
> 
> 
> -----------------------------------------------------------------
> http://gsm.ABV.bg - Вземи сега мелодия за твоя теле
> фон !
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l



More information about the Bioperl-l mailing list