By default, \ n is often used as the line break.
When reading a sequence by row, it is based on a line break.
The content of the read strawberry1.gb file is as follows:
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
ACCESSION JX118024
//
VERSION JX118024.1 GI: 402238751
KEYWORDS.
How
///
SOURCE plastid Fragaria vesca subsp. americana
Example 1: DefaultCopy codeThe Code is as follows :#! /Bin/perl
My $ record = '';
Open (DNA filename, 'f: \ perl \ strawberry1.gb') | die ("can not open the file! ");
$ Record = <dna filename>;
Print $ record;
This is the case where no changes are made, that is, each row read by default. The result is as follows:
F: \> perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
If we change the value of $/, we first change it to $/= "// \ n;
Copy codeThe Code is as follows :#! /Bin/perl
My $ record = '';
Open (DNA filename, 'f: \ perl \ strawberry1.gb') | die ("can not open the file! ");
$/= "// \ N ";
$ Record = <dna filename>;
Print $ record;
The result is as follows:
F: \> perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
ACCESSION JX118024
//
VERSION JX118024.1 GI: 402238751
KEYWORDS.
How
///
Here, we can see that this line is separated by //, and the entire part above is regarded as a line.
It can also be used as a separator and a letter. We use how as the separator, $/= "how \ n ";
Copy codeThe Code is as follows :#! /Bin/perl
My $ record = '';
Open (DNA filename, 'f: \ perl \ strawberry1.gb') | die ("can not open the file! ");
$/= "How \ n ";
$ Record = <dna filename>;
Print $ record;
The result is as follows:
C: \ Documents ents and Settings \ Administrator> f: perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
ACCESSION JX118024
//
VERSION JX118024.1 GI: 402238751
KEYWORDS.
How
C: \ Documents ents and Settings \ Administrator>
Similarly, we can discard rows in the traditional sense. For example, we use the ACCESSION of the fifth line as the separator:
Copy codeThe Code is as follows :#! /Bin/perl
My $ record = '';
Open (DNA filename, 'f: \ perl \ strawberry1.gb') | die ("can not open the file! ");
$/= "ACCESSION ";
$ Record = <dna filename>;
Print $ record;
The result is as follows:
F: \> perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
ACCESSION
F: \>
Let's take an example: Use/\ n as the separator:
Copy codeThe Code is as follows :#! /Bin/perl
My $ record = '';
Open (DNA filename, 'f: \ perl \ strawberry1.gb') | die ("can not open the file! ");
$/= "/\ N ";
$ Record = <dna filename>;
Print $ record;
The expected result should be a line before the fourth line, but is the result true?
F: \> perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
ACCESSION JX118024
//
F: \>
Why didn't the first/match?
In fact, here/this line does not only have one/, but there are other components here. We will delete this line completely, and then enter only one/, and we will match it again.
F: \> perl \ B. pl
LOCUS JX118024 460 bp DNA linear PLN 25-SEP-2012
DEFINITION Fragaria vesca subsp. americana RNA polymerase beta subunit (rpoC1)
Gene, partial cds; plastid.
/
F: \>
The correct result is returned this time.