The easy way would be to look at eval. In the long run, the easy way will give you hard to debug problems and security issues.
The better way is to hand around anonymous subroutines to check your criteria:
my $ifCondition = sub { $_[0] eq 'XB' }; print $ifCondition->($TestVar1); if ($ifCondition->($TestVar1)) { print "TestVar1 (value '$TestVar1') matches the condition."; };
Update: jethro spotted a missing sub
In reply to Re: condition clause in a variable?
by Corion
in thread condition clause in a variable?
by gerry622
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |