in reply to foreach loop

As documented in How do I post a question effectively?, please enclose your code in <code> tags so that people can read it:

<code>
... your code here ...
</code>

Here's your code run through Perl::Tidy so that anyone else can help more easily:

use warnings; print "Please enter the cns file:\n"; chomp($t = <STDIN>); open(THE, $t) or die "Can not open file: $!\n"; @data = <THE>; close THE; $sequence = ''; $end = 0; foreach $line (@data) { if ($line =~ /^\@/) { $chro = $line; } elsif ($line =~ /^[a-zA-Z]/) { $sequence .= $line; } else { $end++ } } $sequence =~ s/\s*$//g; print $chro, "\n"; print $sequence, "\n";

Replies are listed 'Best First'.
Re^2: foreach loop
by morio56 (Initiate) on May 04, 2011 at 16:26 UTC
    the brackets are there I don't know why they didn't show in the post.

      Because you didn't put <code>...</code> tags around your code, and brackets have a special meaning here (for creating links). Please do that now, you can update your original post.