For the printing you should use the
qq{} operator. See
perlop for details. You could then write you code as:
print qq{DATE\t "$1-$2-$3"\n};
When I ran your program I got the "Expected" ouput rather than the "REAL" output. Perhaps your data source was different.
Just a few comments:
It would be better to use \d and \w in the date matching regex.
It would be better to use a negated character class to match the Inron/Exon data.
On the main loop it is better to use while instead of foreach
Braces don't have to be escaped in a quoted string.
I would rewrite the main block of your code something like this:
while (<INFO1>) {
if (/^DATE\s*(\d+)-(\w+)-(\d+)/) {
print qq{\nDATE\t"$1-$2-$3"\n};
}
elsif (/\s*\/intron="([^"]+)/) {
foreach my $item (split('\;',$1)) {
print "Intron\t{Translation%$item}\n";
}
}
elsif (/\s*\/exon="([^"]+)/) {
foreach my $item (split('\;',$1)) {
print "Exon\t{Translation%$item}\n";
}
}
}
--
John.
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.