Can I put functions in arrays to make flexible menus ? I tried this : @stuff = (["menu 1", \&func_1], ["menu 2", \&func_2], ["menu 3", \&func_3]); for ($i = 0; $i < @stuff; $i++) { print "$stuff[$i][0] ($stuff[$i][1])\r\n"; } sub func_1 { print "function 1 called\n"; } sub func_2 { print "function 2 called\n"; } sub func_3 { print "function 3 called\n"; } This code doesn't give any errors, but how do I call the function itself ? Thanks in advance
- Re: functions in arrays Geert Neuts
- Re: functions in arrays Jeff 'japhy/Marillion' Pinyan