I want to have a hash containing references to subfunctions where I can call these functions depending on a user variable, I will try to give a simplified example of what I am trying to do.
my %colors = ( vim => setup_vim(), emacs => setup_emacs(), ) $colors{$editor}(arg1, arg2, arg3)
where setup_vim() and setup_emacs() will be the subfunctions defined later in my file, and $editor is a user-defined variable (i.e. vim or emacs). Is it possible? I cannot get it to work or find good information on this. Thanks.
(Note that I implemented this now as a working switch, but I think a hash like the one above will make it easier to add new entries to my existing code)
Chris r
source share