http://qs321.pair.com?node_id=32602


in reply to RE: cursebox v0.9 - switch{} coding style
in thread cursebox v0.9 - "The Cursed Jukebox"

This is sample code for odie to look at, and will probably be changing. Please don't vote on this node.
#!/usr/local/bin/perl -w use strict; { my %hash = ('a' => {-func => \&sub_one, -parm => 'subone'}, 'b' => {-func => \&sub_two, -parm => 'two,two_a,two_ +b'}, 'c' => {-func => \&sub_three, -parm => ''}, ); &{$hash {'a'}->{-func}} (split ',', $hash {'a'}->{-parm}); &{$hash {'b'}->{-func}} (split ',', $hash {'b'}->{-parm}); &{$hash {'c'}->{-func}} (split ',', $hash {'c'}->{-parm}); } sub sub_one { print "sub_one got ", scalar @_, " parameters\n"; print "sub_one parameters: $_\n" foreach (@_); } sub sub_two { print "sub_two got ", scalar @_, " parameters\n"; print "sub_two parameters: $_\n" foreach (@_); } sub sub_three { print "sub_three got ", scalar @_, " parameters\n"; print "sub_three parameters: $_\n" foreach (@_); }
--Chris

e-mail jcwren