$pattern = [qw(X OP Y is Z), 'IF', sub {$_[0]->{X} $_[0]->{OP} $_[0]->{Y} == $_[0]->{Z}} ]; $input = [ 3 '+' 4 is 7 ] ;