Greetings, I'd like to know how to pass variables fetched by TK/entry to a subroutine by using a Button. The Button/-command line in the following script is obviously wrong, but should suffice to illustrate what I want it to do.
I'd be happy if someone could tell me how to do this properly. ----------- #! /usr/bin/perl -w use strict; use Tk; my $main = MainWindow->new; my $var1 = $main -> Entry( -width => 30 ); $var1 -> pack; my $var2 = $main -> Entry( -width => 30 ); $var2 -> pack; $main -> Button ( -text => 'Add', -command => \&add_item($var1, $var2) # ^^^^^^^^^^^^^^^^^^^^^^ ) -> pack; MainLoop; sub add_item { print "Added @_\n"; } ----------- Best regards, oliver. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>