Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
problem in do until loop

Posted by naveen (naveen), 30 January 2008
ID   ACA10_ARATH             Reviewed;        1069 AA.
AC   Q9SZR1; Q9M0D3;
suppose the above lines are in a file ID1 .pl
we want to write a program for the retrieval of only  id

number(ID ACA10_ARATH)
here what we are trying to do is find the position of id and then

we want to run a do until loop which will print the text till a

white space is reached
but the until loop is not working it is only printing the first letter
that is A. here we do $pos=$pos+5 because the id number starts

from the 5th position.
print "cannot open the file";

close "filename";
$protein=join(' ',@protein);

print $protein;
print "enter d motif";
chomp $motif;
print "id is present at";}
print "$pos\n";

print $pos1;

#problem in the loop

print $protein1[$pos1];
}until ( $protein [$pos1]==' ');

Posted by admin (Graham Ellis), 30 January 2008
I think the end of your condition - the vital thing I need to see to answer you - is missing .... can you complete that code for us?


Posted by KevinAD (KevinAD), 30 January 2008
what is the input $motif?

Also: please don't ignore the other thread you started. Feedback from you is important.

Posted by naveen (naveen), 31 January 2008
sir input motif is ID

Posted by KevinAD (KevinAD), 31 January 2008
on 01/31/08 at 06:55:01, naveen wrote:
sir input motif is ID

You mean to say you literally enter "ID" as the input? Then why are you searching for the position of "ID"? Its at the beginning of the line as far as I can tell from what little data you have posted.  

Anyway, this is wrong:

print $protein1[$pos1];
}until ( $protein [$pos1]==' ');

you have $protein instead of $protein1 in the until() condition so it will just loop forever.

If you had used "strict" you would have caught this error.

Should be:

  print $protein1[$pos1];
} until ( $protein1[++$pos1] eq ' ');

Posted by naveen (naveen), 31 January 2008
thank you sir for your reply.
ill try run this code.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho