sub init_commands { # Fill %Commands hash for parsecommands # %Commands{commandname}{pattern} = # %Commands{commandname}{function} = ['modulename', [['name', number of arguments]] # %Commands{commandname}{syntax} = $Commands{'log'}->{'pattern'} = '^log (.*)$'; $Commands{'log'}->{'function'} = ['', ['createlog', 1]]; $Commands{'log'}->{'syntax'} = 'log '; $Commands{'modules saveall'}->{'pattern'} = '^modules saveall$'; $Commands{'modules saveall'}->{'function'} = ['', ['savemodules', 0]]; $Commands{'modules saveall'}->{'syntax'} = 'modules saveall'; $Commands{'modules loadall'}->{'pattern'} = '^modules loadall ([\w\.]+)$'; $Commands{'modules loadall'}->{'function'} = ['', ['loadmodules', 1]]; $Commands{'modules loadall'}->{'syntax'} = 'modules loadall '; ... and so on.. }