develooper Front page | perl.beginners | Postings from March 2002

accessing an array with a variable

Thread Next
From:
Dennis.Warren
Date:
March 5, 2002 07:06
Subject:
accessing an array with a variable
Message ID:
0AEF0EB21F09D211AE4E0080C82733BF02B8337D@mailhost.aculab.com
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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About