Without more code, I can't totally understand what might be wrong.
When you increment $num are you sure that $line also get's updated?
I'm wondering if you are expecting $array[$num] to get reevaluated with
the new value of $num every time you dereference $line.  If so, that's a bad
assumption.
$line = $array[$num] is probably a one-time thing, and you would also have
to
dynamically update $line to grab the data that resides in $array[$num] (ie.
using
a more current value of $num)

Does that make sense?
-- Brad

> Hi,
>
> I believe it is possible to access an array through a variable, but I'm
> ghaving trouble doing it.
> I want to read in a text file and display it, on line at a time, depending
> on an
> increment counter triggered by a 'next' or 'previous' button.
>
> I am trying to do this with Perl/Tk, but it fails to work, only displaying
> the initial line of the text file:
>
> This is the definition of the variable
>
> $line=$array[$num];
>
> $num is incremented elsewhere with the click of the button.
>
> This is the attempt to display the variable on screen.
>
> $txtmain->configure(-textvariable => \$line,
> .....);
>
> I know that the incrementing is successful because replacing $line with
$num
> as the -textvariable gives the right output.
>
> Any help would be greatly appreciated.
>
>
> Dennis Warren
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to