I need to process a comma delimited list and generate an internal event
for each item. Below is what i have for my action list, but I don't know
if this is the best way to accomplish what I'm doing:
action= assign %list $1; \
assign %i 0; \
assign %have_item 1; \
while %have_item ( \
eval %list_item ( \
my $i = %i; \
my @list = split(/,/,"%list"); \
return $list[$i]; \
); \
event 0 PROCESS_ITEM %list_item; \
eval %i ( my $i = %i; return $i++; ); \
eval %have_item ( \
my $i = %i; \
my @list = split(/,/,"%list"); \
if( $i < scalar(@list) ){ \
return 1; \
}else{ \
return 0; \
} \
); \
)
The interaction between my loop control variables in the SEC context
versus in the perl mini-programs in 'eval' seem cumbersome. Is there a
better way to do this?
Also, is it correct to initialize my while loop control %have_item
before starting the while loop? Or is that not necessary? There is an
assumption here that $1 is not an empty list, and that should be ok as
there is a check before this rule and this rule will not trigger unless
the list is not empty.
Thanks,
Bond
------------------------------------------------------------------------------
_______________________________________________
Simple-evcorr-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users