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.
$l
dford Ritchie [mailto:[EMAIL PROTECTED]]
Sent: 05 March 2002 19:27
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: accessing an array with a variable
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
From: [EMAIL PROTECTED]
> 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.
>
> Th
in the place where you increment $num do you re-assign $line?
$num++; ## this changes only $num
$line=$array[$num]; # this changes $line to the new index that $num is now.
if you don't do the second line then $line will still be
$array[whatever $num was before]
you need to reassign $line to th