open(GENBANK, "/Users/ale/Desktop/seq.gp.txt") or die; # Opening file results.txt in write mode with the help of ">" operator. open (FH, ">", "results.txt"); my $content = join("", ); close(GENBANK); $content =~ /LOCUS\s+([A-Z0-9_]+)/; my $locus = $1; $content =~ /DEFINITION\s+(\w+\W+); my $acids = $1 ; $content =~ /TITLE([a-z0-9+\s]+)/; my $aminoAcids = uc($1); print(FH "$locus\n$acids\n$aminoAcids\n");