tags:

views:

122

answers:

1
+2  A: 

When you create the Button, you are passing the current value of $select_value to the button/command set up. By the time you press the button, the old value of $select_value has already been evaluated and set in the command argument list. You need to make your command a closure, so that $select_value is not evaluated until the button is pressed, e.g.:

-command => sub { Add_Birthday($select_value, "dob", $edit) }

For completeness, I should also mention that another way of doing this is to pass in references:

-command => [\&Add_Birthday, \$select_value, "dob", \$edit]

But that requires rewriting the function to accommodate the references in the argument list.

runrig
Thank you very much..
kiruthika