Save me from moving back to Mathematica to
do all my PhD work!! I'm not trusting perl at all at this
point! :)
Thanks to all who posted replys to my first post
last Fri. Also to all those who chatted with me
as to possibilities as to why my code wasn't working.
Unfortunately, none of the comments seemed to clear
up the bizare behaviour. Perl still is telling
me that a "t" appears earlier than it really does.
I would really appreciate someone downloading my code, and
using it exactly as it is written, and with the seperate
input file (the 80 chars + ?newline? that you can see
in the output)
one.seq.one.line.7.19.04
(vs. quoting it and putting it right in the
code itself). If someone would do that, and respond back
as to what they got, I would really appreciate it. I'd like
someone else to verify it is not just my machine!. I think
someone else may get hooked on this as well -- to me at
least it is just truely bizarre (oh yeah, and frustrating
as ____!).
One last note.
The input line consists of 80 chars (and then I guess
a new line). When I open it with vi, it says:
"one.seq.one.line.7.19.04" 1L, 81C
so everything seems correct.
Here's another bit of weirdness. As I start deleting
away charactes, things go from weird (different results as
to where the first "t" is found in the two passes through the
input file) to normal (same results as to where the first "t"
is found in the two passes through the input file).
delete first 30 char weird
delete additional 5 char normal
start anew:
delete first 32 char weird
delete additional 1 char weird
delete additional 1 char weird
delete additional 1 char normal
start anew:
delete first 34 char weird
delete additional 1 char normal
Thanks much to all who have comments -- and
again, I'd love to have someone run my identical
code and see if they get the same resuls.
I'm running:
$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
Here is my code and output:
#!/usr/bin/perl -w
+
+
open (IN, "one.seq.one.line.7.19.04") or die "can't open IN: $!";
open (OUT, ">out.index.7.19.04") or die "can't open OUT: $!";
+
+
while(<IN>){
+
+
print OUT $_; print OUT scalar(localtime), "\n";
print OUT "The first occurance of little a is: ", index($_,"a"),
+"\n";
print OUT "The first occurance of little c is: ", index($_,"c"),
+"\n";
print OUT "The first occurance of little g is: ", index($_,"g"),
+"\n";
print OUT "The first occurance of little t is: ", index($_,"t"),
+"\n";
print OUT "\n\n";
+
+
print OUT $_;
print OUT scalar(localtime), "\n";
print OUT "The first occurance of little a is: ", index($_,"a"),
+"\n";
print OUT "The first occurance of little c is: ", index($_,"c"),
+"\n";
print OUT "The first occurance of little g is: ", index($_,"g"),
+"\n";
print OUT "The first occurance of little t is: ", index($_,"t"),
+"\n";
print OUT "\n\n";
+
+
print $_;
print "The first occurance of little a is: ", index($_,"a"), "\n"
+;
print "The first occurance of little c is: ", index($_,"c"), "\n"
+;
print "The first occurance of little g is: ", index($_,"g"), "\n"
+;
print "The first occurance of little t is: ", index($_,"t"), "\n"
+;
print "\n\n";
+
+
}
~
Notice the difference in the output regarding where the first occurance of
little t is.
The output to screen is "normal" as well.
ATGGACTGCACCTGGAGGATCCTCTTCTTGGTGGCAGCAGCTACAGgcaagagaatcctgagttccaggg
+ctgatgaggg
Mon Jul 19 10:39:31 2004
The first occurance of little a is: 48
The first occurance of little c is: 47
The first occurance of little g is: 46
The first occurance of little t is: 49
+
+
+
+
ATGGACTGCACCTGGAGGATCCTCTTCTTGGTGGCAGCAGCTACAGgcaagagaatcctgagttccaggg
+ctgatgaggg
Mon Jul 19 10:39:31 2004
The first occurance of little a is: 48
The first occurance of little c is: 47
The first occurance of little g is: 46
The first occurance of little t is: 55
Thanks so much!
Edit by castaway - moved code tags around actual code.
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.