in reply to Tk interface and the rest of the program -- II

You have the right idea. For small callbacks, I usually create an anonymous sub:
my $button = $top->Button ( -text => "click me", -command => sub {system "myscript.pl $filen +ame"} )->pack();
and then have myscript.pl read in the filename from the command line.

-Mark

Replies are listed 'Best First'.
Re: Re: Tk interface and the rest of the program -- II
by Anonymous Monk on Aug 15, 2002 at 20:30 UTC
    Hi kvale,

    So in myscript.pl, I should have something like

    my $filename = @_;


    in order to access $filename from the Tk interface?

    Thank you so much!
      Your statement assigns an array to a scalar, not what you want. To extract the subroutine parameter, use
      my $filename = shift;
      This shifts the first element off of @_ and assigns it to $filename.

      -Mark