[lug] variable scope in perl/Tk ?

arnie asherman1 at uswest.net
Wed Apr 12 19:28:03 MDT 2000


I have a pair of Radiobuttons I am using to set a variable named
$mode...

$frame_1->Radiobutton(-text => "PRODUCTION",
 -command => sub {
  $mode = PRODUCTION;
)->pack(-side => 'right');


$frame_1->Radiobutton(-text => "TRAINING",
 -value => "0",
 -command => sub {
  $mode = TRAINING;
)->pack(-side => 'right');


I later try to use the value in $mode like this:


sub post_warning {
  if ($checkbutton_CO_value == 1) {
   `cp message/warn_template user_msg_{$MODE}_CO_warn`;
  }
}



When I run this the file I get is named user_msg_{}_CO_warn
How can I get this file to end up with the name
user_msg_PRODUCTION_CO_warn or user_msg_TRAINING_CO_warn ?

Thanks,

--
arnie sherman
frenomulax at bigfoot.com

"Paradise is exactly like where you are right now,
 only much, much better."
        -Laurie Anderson








More information about the LUG mailing list