in reply to Re: Re: Functions and Tk
in thread Functions and Tk

It isn't really working. Tk::Error AUTOLOAD 'Tk::Toplevel::destory' at line 97 happend because you said ->destory when you meant ->destroy - and your window fgoes away because your program died.

To make the subroutine work, I think the part you're missing is this:

doit('here is my input', 'some more'); sub doit { my ( $in1, $in2 ) = @_; print "$in1\n"; print "$in2\n"; }

subs all receive their parameters in @_ - then you transfer them in to local variables for readability, isolation, etc.

In the orginal form of my example the line my $thiswin = $_[0]; in the close_win sub did this, just getting the first (and only) elment of @_;

--Bob Niederman, http://bob-n.com

All code given here is UNTESTED unless otherwise stated.

Replies are listed 'Best First'.
Functions and Tk
by surrealistfashion (Acolyte) on Aug 24, 2003 at 03:10 UTC

    That fixed it. thanks a lot. You have just helped me figure out something that has been driving me nuts for almost a week.

    Thanks again. James