Infinite loop problem

2005-09-13 Thread Vineet Pande
Dear Perl Guru: I want to write a script which takes input a text file with sequence of alphabets (amino acids) like GAGAGAGAGGA etc. and converts them to a three letter corresponding code [G= GLY, A= ALA]. The output should be then written to another file. I wrote the following script, bu

Re: converting to FLOATING_POINT..

2005-08-17 Thread Vineet Pande
print OUT $temp; print OUT "\n"; } } } } Thanks again! Cheers v From: Rex Rex <[EMAIL PROTE

converting to FLOATING_POINT..

2005-08-17 Thread Vineet Pande
Hi: In the following piece of script, I would like to convert the $time after * by 2.0 to floating point, for instance i want 0*2 to be printed as 0.0; How to do that? if ($_ =~ ( /TEMP/ )) { my $time = (substr($_, 30, 14));

matching pattern & printing

2005-08-17 Thread Vineet Pande
Hi: In the following perl script, I would like to print all the lines in a file (mdout_short.txt) to temp.txt which have "NSTEP" as a word: use strict; use warnings; my $mdout_file = "mdout_short.txt"; my $mdout_xtemp_file = "temp.txt"; open

about backslash..(correction)

2005-08-10 Thread Vineet Pande
my previous mail should be corrected for backslash to forward slash / thanks vineet _ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ -- To

use of backslash..

2005-08-10 Thread Vineet Pande
Hello, I faced an example where in a loop: if (\$base2\) is used>> the backslashes are used for what? for instance than why not we use the same for an array variable: foreach (@dna) Does it have to do with if(0) or if (1) rather than literally taking the value .. thanks in advance cheers,

"Join" Function

2005-08-08 Thread Vineet Pande
hi, In the following code which reads a file.txt (SEE ATTACHMENT) where I am trying to understand how to put the DNA sequence in to a single string... print "enter file with DNA sequence: "; $seqfile = ; chomp $seqfile; unless ( open(DNAFILE, $seqfile) ) { print "can't open!!\n"; exit; } @dna =

"$#{$array} "

2005-07-29 Thread Vineet Pande
Hi, I don't not understand how the $#{$array_r} returns "highest" element as 4 and not 5??? #!/usr/bin/perl use warnings; use strict; my @array = (1,2,3,4,5); my $array_r = [EMAIL PROTECTED]; print "the highest element is number $#{$array_r}\n"; Cheers V __

$_ and split function...

2005-07-16 Thread Vineet Pande
Hi In the following code #!/usr/bin/perl use warnings; use strict; my $found = 0; $_ = "Nobody wants to hurt you... 'cept, I do hurt people sometimes, Case."; my $sought = "people"; foreach my $word (split) { if ($word eq $sought

array

2005-07-16 Thread Vineet Pande
Hi: I want to write a code storing in "memory" a list of numerical values and then asking the user to guess a number, if that number matches one in memory, program should exit; otherwise keep asking... ** #!/usr/bin/perl use warnings; use strict; my (@memory, $g

"sort" usage in arrays

2005-07-04 Thread Vineet Pande
Hello! In the following code: ** #!/usr/bin/perl use warnings; use strict; my @unsorted = (1, 2, 11, 24, 3, 36, 40, 4); my @number = sort { $a <=> $b } @unsorted; print "Numeric sort: @number\n"; ** re

perl 'advancing' variable facility..

2005-05-25 Thread Vineet Pande
Hi: I don't understand the way perl 'advances' the variables along the range a-z, A-Z, and 0-9. For example from a book $a = "A9"; print ++$a, "\n"; gives B0 as expected, but, $a = "Zz"; print ++$a, "\n"; gives AAa. Why?? why not Aa only! also $a = "9z"; print ++$a, "\n"; gives 10. and wh

output in a single line

2005-05-25 Thread Vineet Pande
Hi I tried the following script #!/usr/bin/perl use warnings; use strict; print "Currency converter\n\nPlease enter the exchange rate: "; our $rupee_c1 = ; print "Please enter the Amount in Rupees: "; our $rupee = ; print "$rupee rupees are ", ($rupee/$rupee_c1), " Euros\n"; when i execute