|Perl: the Markov chain saw|
Re: Values changingby liverpole (Monsignor)
|on May 12, 2010 at 22:39 UTC||Need Help??|
First, please format your question putting tags <code> and </code> around your code. Otherwise it's very difficult to read.
Secondly, try putting:
at the beginning of your program. Once you've fixed the errors that it gives you, you may notice that when you try to print the value of $i in the subroutine print_seq that its value is undefined:
That's because in the subroutine makeline() you are making $i lexically-scoped:
so you won't be able to see the value of that variable $i. To make $i (or other variables) global, just defined them at the top of your program.
Another thing -- you shouldn't be using the variables $a and $b; they have special meaning in a Perl script (they are used for sorting -- see http://perldoc.perl.org/functions/sort.html for information).
You're not using the values returned from makeline, nor are you using the values $i and $j anywhere (except that you're assigning them in one place each).
One other problem you have is that when you create the Scrolled 'Entry' widget, there's nothing in them yet. So that's not the time to be fetching the contents. You may want to keep those Entry widgets in a global array, and create another subroutine (executable via a new button) to grab the values of all the Entry widgets when you're ready to use them.
That's just a start ... please try fixing the formatting of your post, and give more explicit details about what you're trying to do, and what's going wrong, and we'l try to help you out.
For reference, here's what I think you should have for code so far: