...at this point, sec supports only few basic branching statements (such as if..else) in action list, and there is no support for switch-like actions. Therefore, switches would have to be implemented in terms of multiple if-actions like you have done. However, some of your Perl statements can be made more concise, for instance, instead of if ($test eq "test) { return 1; } return 0; you can just write $test eq "test". Provided this is the last statement in the 'eval' code or function invoked with 'lcall', the value of this statement is also the return value that is assigned to output variable. Also, if speed is important for you and your switch gets executed frequently, I'd recommend to replace 'eval' with 'lcall'. regards, risto
2015-10-06 13:26 GMT+03:00 Bond Masuda <bond.mas...@jlbond.com>: > Hi, > > I need to do something like this: > > lcall %result %input -> ( sub { ... } ) ; \ > switch %result \ > case 'x': ( <action list A> ) \ > case 'y': ( <action list B> ) \ > case 'z': ( <action list C> ) > > > right now, I'm implementing this like this: > > lcall %result %input -> ( sub {...} ); \ > if %result ( \ > eval %is_x ( \ > if( %result eq 'x' ) { return 1; } \ > return 0; \ > );\ > if %is_x ( \ > <action list A> \ > );\ > eval %is_y ( \ > if( %result eq 'y' ) { return 1; } \ > return 0; \ > );\ > if %is_y ( \ > <action list B> \ > );\ > eval %is_z ( \ > if( %result eq 'z' ) { return 1; } \ > return 0; \ > );\ > if %is_z ( \ > <action list C> \ > );\ > ); > > I'm hoping someone can show me a better way. > > Thank you, > Bond > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Simple-evcorr-users mailing list > Simple-evcorr-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users >
------------------------------------------------------------------------------
_______________________________________________ Simple-evcorr-users mailing list Simple-evcorr-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users