s{ \Q^^[\E # start operator block (IF|WHILE) # operator name \Q]=\E # start condition ([^\n]*) # condition expression \Q^^\E # end condition ((?:.(?!\^\^))*.) # contents (?: \Q^^[ELSE]^^\E # start optional else block ((?:.(?!\^\^))*.) # contents )? # ensure it is optional \Q^^[END]^^\E # end operator block } { $self->tempeval($1, $2, $3, $4) }gisex for @{ $self->{content} };