Sorry about the lack of information. The data file itself is ~1000 lines of DNA sequence (e.g. NNNNNNAAACCTAGGAATACGCGT) separated by linebreaks. Again, it's very simple code, which is what makes this so frustrating:
#!/usr/bin/perl
use warnings;
use strict;
my $filename = 'T7.fa';
open(DNA, $filename);
my @lines = <DNA>;
close DNA;
chomp(@lines);
my $genome = join('',@lines);
print "$genome\n";
When I run this, I get no error messages, but $genome only prints out what appears to be a concatenation of the last two lines: roughly
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN.
In lieu of
join, I tried the dot operator like this:
... # <DNA> opened
my $genome = '';
while (<DNA>) {
chomp($_);
$genome.=$_;
}
close(<DNA>);
print "$genome\n";
This too gives no errors and returns a short string of Ns. When I print $genome after each iteration of the
while loop it doesn't seem to be adding to the string, but rather erasing the old string and inserting JUST the current line. As I mentioned before, in Windows, both versions return what I expect...a "paragraph" of ~20000 bases. I DO have the same problem on a SuSE 9.0 installation, which I believe includes 5.8.0, but haven't tried anything earlier. Packages that are obviously Perl-driven all seem to work fine on my machine. Thanks so much!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.