in reply to calling functions with same names but in different modules depending on user input

Dittos on merlyn's OOP comments. If you're not ready to go whole hog OO you could go half hog using a hash as a dispatch table.

my %dispatch = ( foo => \&A::just_print, bar => \&B::just_print ); if( exists $dispatch{ $user_input } ) { $dispatch{$user_input }->( "hello" ); } else { warn "Unknown user input "$user_input"\n"; }
  • Comment on Re: calling functions with same names but in different modules depending on user input
  • Download Code