#!/usr/bin/perl -w use Data::Dumper; $Data::Dumper::Deparse = 1; my $change_mode = \&change_mode; sub change_mode { return "returning: @_ " } #Case 1: Callback routine called directly with anonymous reference Button(-text => 'To Lower Case', -command => sub { &change_mode(1) } ); #Case 2: Callback routine called with argument via named reference ver. 1 Button(-text => 'To Upper Case', -command => &{$change_mode}(2) ); #Case 3: Callback routine called with argument via named reference ver. 2 Button(-text => 'To Mixed Case', -command => $change_mode->(3) ); sub Button { my %h = @_; print Dumper(\%h); } #### $VAR1 = { '-text' => 'To Lower Case', '-command' => sub { &change_mode(1); } }; $VAR1 = { '-text' => 'To Upper Case', '-command' => 'returning: 2 ' }; $VAR1 = { '-text' => 'To Mixed Case', '-command' => 'returning: 3 ' };