jkmiller has asked for the wisdom of the Perl Monks concerning the following question:
~ Notice the difference in the output regarding where the first occurance of#!/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"; + + }
Thanks so much!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
Edit by castaway - moved code tags around actual code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Continueing probles w/ "index" -- more info
by danielcid (Scribe) on Jul 19, 2004 at 18:09 UTC | |
|
Re: Continueing probles w/ "index" -- more info
by Joost (Canon) on Jul 19, 2004 at 18:17 UTC | |
|
Re: Continueing probles w/ "index" -- more info
by Not_a_Number (Prior) on Jul 19, 2004 at 18:35 UTC |