arrays - How to match the data with new line.? -
I tried to match the data with Newline and some other data but it is not working. My Perl Code
open (data, "file name"); @ File = & lt; Data & gt ;; @get = grep {m / ^ \ & gt; * \ N. * @} File; Print "$ Mill [1]"; My file like this
& gt; 1AA7 LSLLSEVESFVLSVVPSGPLKAEVAQKLEEVFAGKQSELEVLLEFLKSKPVLSPLSKGVLGFVFSLSVPSEKGLQKKKFVQQALQGQGEPQQLEKAVKLFK & gt; 1ABV SEFVSVAKPFAKAAFEFAVEKQSVEKFQELLAFAAEVSKQEQLAELLSGALAPESLAESFVAVCGEQLEEQGQQLVKVLAEQGKLQALPEVLEQFVKLKAVSEASAEVEVVSAAALSEQQLAKVSAALEKKLSK & gt; 1AEP AAGKVQVAEAVQQLQKSVVQAAKELKESLGLPSPEEALQLLSEQAQAFKSKVAEVSSSLKQEAEKKQGSVAEQLQAFAKQLQQSVKEAASSLQLQEQLQSLQSALSQVGKQFQEVASKSQASAQEAFAPVQSALQEAAEKSKEAAAQLQQSVQSAVQKPAQ program in only & gt; 1ABV is not working \ n and the second charactor of my code but I expect this code to be output to & gt; 1ABV SEFVSVAKPFAKAAFEFAVEKQSVEKFQELLAFAAEVSKQEQLAELLSGALAPESLAESFVAVCGEQLEEQGQQLVKVLAEQGKLQALPEVLEQFVKLKAVSEASAEVEVVSAAALSEQQLAKVSAALEKKLSK It seems that you want subsection mode for reading.
You can get it by modifying it:
Use strict; Use warnings; Local $ / = ''; # My data at paragraph mode = & lt; Data & gt ;; Print $ data [0]; __DATA__ & gt; 1AA7 LSLLSEVESFVLSVVPSGPLKAEVAQKLEEVFAGKQSELEVLLEFLKSKPVLSPLSKGVLGFVFSLSVPSEKGLQKKKFVQQALQGQGEPQQLEKAVKLFK & gt; 1ABV SEFVSVAKPFAKAAFEFAVEKQSVEKFQELLAFAAEVSKQEQLAELLSGALAPESLAESFVAVCGEQLEEQGQQLVKVLAEQGKLQALPEVLEQFVKLKAVSEASAEVEVVSAAALSEQQLAKVSAALEKKLSK & gt; 1AEP AAGKVQVAEAVQQLQKSVVQAAKELKESLGLPSPEEALQLLSEQAQAFKSKVAEVSSSLKQEAEKKQGSVAEQLQAFAKQLQQSVKEAASSLQLQEQLQSLQSALSQVGKQFQEVASKSQASAQEAFAPVQSALQEAAEKSKEAAAQLQQSVQSAVQKPA Output:
& gt; 1AA7 LSLLSEVESFVLSVVPSGPLKAEVAQKLEEVFAGKQSELEVLLEFLKSKPVLSPLSKGVLGFVFSLSVPSEKGLQKKFVQQALQGQGEPQQLEKAVKLFK Note: Array index starts at 0 in Perl.
Comments
Post a Comment