in reply to Re^3: Help with TK writing shorter code
in thread Help with TK writing shorter code

I'm trying to figure out how to keep track of $x. I want to be able to pass a unique serial number that is associated with the start button. So, for example, if slot 1 contained serial number 01234567, I want to be able to process that serial number if slot 1's start button is pressed. I'm pretty new to perl so I'm kind of floundering here. Thanks for your help.
  • Comment on Re^4: Help with TK writing shorter code

Replies are listed 'Best First'.
Re^5: Help with TK writing shorter code
by jdporter (Paladin) on Sep 22, 2011 at 19:48 UTC

    You could pass the slot number to the compute call:

    $goSlot[$x] = $slot->Button( ... -command => sub { compute($x) },

    Then, in the compute sub, you can access @sernums, @partnums, etc. e.g.:

    sub compute { my( $slotnum ) = @_; print "sernum=$sernums[$slotnum], partnum=$partnums[$slotnum]\n"; }
    I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.
      Thanks, jdporter.