You could do it using eval.
--my $a = 10; my $b = 20; my $op = '>='; if (eval "$a $op $b") { print "true\n"; } else { print "false\n"; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Dynamic operators
by davorg
in thread Dynamic operators
by Preceptor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |