You probably want something like this but as you don't describe what this code is supposed to do (and it is somewhat incomprehensible) I am kinda guessing
#!/usr/local/bin/perl -w
use strict;
print "Please type in the name of a file\n";
my $file = <STDIN>;
chomp $file;
my ($annotation, $seq) = get_dna ($file);
# convert $annotation array reference to a real array
my @annotation = @$annotation;
print "Annotation:\n\n", @annotation, "\n\n\n";
print "Sequence:\n\n", $seq, "\n";
sub get_dna {
my ($file) = @_;
my @annotation = ();
my $seq = '';
my $in_sequence = 0;
open FILE, $file or die "Can't open $file, Perl says $!\n";
while ( my $line = <FILE> ) {
last if $line =~ m|^//\n|; # stop if line has just // on it
$in_sequence = 1 if $line =~ m/^ORIGIN/;
if ($in_sequence) {
$seq .= $line;
} else {
push @annotation, $line;
}
}
close FILE;
# remove all spaces and digits from $seq. add \n to remove newline
+s
$seq =~ s/[\s0-9]//g;
# return @annotation array as a scalar reference and scalar $seq
return \@annotation, $seq;
}
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print